• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 297,  comments - 15,  trackbacks - 0
            from waterloo university

            /*
            00002  * This file is shared between libc and the kernel, 
            so don't put anything
            00003 * in here that won't work in both contexts. 00004 */ 00005 00006 #ifdef _KERNEL 00007 #include <types.h> 00008 #include <lib.h> 00009 #else 00010 #include <string.h> 00011 #endif 00012 00013 /* 00014 * C standard function - copy a block of memory. 00015 */ 00016 00017 void * 00018 memcpy(void *dst, const void *src, size_t len) 00019 { 00020 size_t i; 00021 00022 /* 00023 * memcpy does not support overlapping buffers,
            00024 * so always do it forwards.
            00025 * (Don't change this without adjusting memmove.) 00026 * For speedy copying, optimize the common case
            00027 * where both pointers and the length are word-aligned, 00028 * and copy word-at-a-time insteadof byte-at-a-time.
            00029 *Otherwise, copy by bytes. 00030 * The alignment logic below should be portable. 00031 * We rely onthe compiler to be reasonably intelligent 00032 * about optimizing the divides and modulos out.
            00033 * Fortunately, it is.*/ 00034 00035 if ((uintptr_t)dst % sizeof(long) == 0 && 00036 (uintptr_t)src % sizeof(long) == 0 && 00037 len % sizeof(long) == 0) { 00038 00039 long *d = dst; 00040 const long *s = src; 00041 00042 for (i=0; i<len/sizeof(long); i++) { 00043    d[i] = s[i]; 00044 } 00045 } 00046 else { 00047 char *d = dst; 00048 const char *s = src; 00049 00050 for (i=0; i<len; i++) { 00051 d[i] = s[i]; 00052 } 00053 } 00054 00055 return dst; 00056 }
            /*
            00014  * C standard function - copy a block of memory, 
            00015 * handling overlapping * regions correctly. 00016 */ 00017 00018 void * 00019 memmove(void *dst, const void *src, size_t len) 00020 { 00021 size_t i; 00022 00023 /* 00024 * If the buffers don't overlap, it doesn't matter 00025 * what direction we copy in. If they do, it does,
            00026 * so just assume they always do.We don't concern
            00027 * ourselves with the possibility that the region
            00028 * to copy might roll over across the top of memory,
            00029 * because it's not going to happen. 00030 * If the destination is above the source, we have 00031 * to copy back to front to avoid overwriting the
            00032 * data we want to copy. 00033 * 00034 * dest: dddddddd 00035 * src: ssssssss ^ 00036 * | ^ |___| 00037 * |___| 00038 * 00039 * If the destination is below the source, we have to 00040 * copy front to back. 00041 * 00042 * dest: dddddddd 00043 * src: ^ ssssssss 00044 * |___| ^ | 00045 * |___| 00046 */ 00047 00048 if ((uintptr_t)dst < (uintptr_t)src) { 00049 /* 00050 * As author/maintainer of libc, take advantage of the 00051 * fact that we know memcpy copies forwards. 00052 */ 00053    return memcpy(dst, src, len); 00054 } 00055 00056 /* 00057 * Copy by words in the common case. Look in 00058 * memcpy.c for more information. 00059 */ 00060 00061 if ((uintptr_t)dst % sizeof(long) == 0 && 00062 (uintptr_t)src % sizeof(long) == 0 && 00063 len % sizeof(long) == 0) { 00064 00065    long *d = dst; 00066 const long *s = src; 00067 00068 /* 00069 * The reason we copy index i-1 and test i>0 is that 00070 * i is unsigned - so testing i>=0 doesn't work. 00071 */ 00072 00073 for (i=len/sizeof(long); i>0; i--) { 00074    d[i-1] = s[i-1]; 00075 } 00076 } 00077 else { 00078 char *d = dst; 00079 const char *s = src; 00080 00081 for (i=len; i>0; i--) { 00082    d[i-1] = s[i-1]; 00083 } 00084 } 00085 00086 return dst; 00087}
            
            
            	
            posted on 2009-03-25 15:05 chatler 閱讀(223) 評論(0)  編輯 收藏 引用 所屬分類: C++_BASIS
            <2010年1月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            常用鏈接

            留言簿(10)

            隨筆分類(307)

            隨筆檔案(297)

            algorithm

            Books_Free_Online

            C++

            database

            Linux

            Linux shell

            linux socket

            misce

            • cloudward
            • 感覺這個博客還是不錯,雖然做的東西和我不大相關(guān),覺得看看還是有好處的

            network

            OSS

            • Google Android
            • Android is a software stack for mobile devices that includes an operating system, middleware and key applications. This early look at the Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
            • os161 file list

            overall

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            国产精品久久久99| 久久国产色AV免费观看| 国产2021久久精品| 久久天天日天天操综合伊人av| 办公室久久精品| 久久精品视频一| 久久天天躁狠狠躁夜夜网站| 欧美777精品久久久久网| 亚洲?V乱码久久精品蜜桃| 色婷婷久久综合中文久久蜜桃av| 久久综合久久久| 久久久久se色偷偷亚洲精品av| 精品熟女少妇a∨免费久久| 国内精品久久久久久中文字幕| 人人妻久久人人澡人人爽人人精品| 九九精品99久久久香蕉| 亚洲午夜精品久久久久久app| 久久久久99精品成人片欧美| 久久久久99精品成人片| 久久精品国产亚洲av麻豆色欲| 久久影院午夜理论片无码| 久久香蕉国产线看观看99 | 午夜天堂av天堂久久久| 国产巨作麻豆欧美亚洲综合久久| 综合人妻久久一区二区精品| 久久综合伊人77777麻豆| 99久久国产综合精品麻豆| 久久久无码精品亚洲日韩蜜臀浪潮 | 久久夜色精品国产亚洲| 久久国产成人午夜aⅴ影院| 精品久久久久久中文字幕| 久久精品国产第一区二区三区| 无码任你躁久久久久久老妇App| 久久亚洲国产成人影院网站| 99久久国产热无码精品免费久久久久| 久久久久久国产精品美女| 亚洲国产高清精品线久久| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 久久婷婷国产剧情内射白浆| 欧美性猛交xxxx免费看久久久| 久久精品成人|