-
-
- void *memmove(void *dest , const void *src , size_t count)
- {
- assert( (dest != NULL) && (src != NULL));
- assert( count > 0 );
-
- char *psrc = (char *) src;
- char *pdest = (char *) dest;
-
- if( pdest < psrc )
- {
-
- while( count-- )
- *pdest++ = *psrc++;
- }
- else if( psrc < pdest )
- {
-
- psrc = psrc + count - 1;
- pdest = pdest + count - 1;
- while( count-- )
- *pdest-- = *psrc--;
- }
- return dest;
- }
-
-
-
- void *memmcpy(void *dest , const void *src , size_t count)
- {
- assert( (dest != NULL) && (src != NULL));
- assert( count > 0 );
-
- char *psrc = (char *) src;
- char *pdest = (char *) dest;
- while( count-- )
- *pdest++ = *psrc++;
-
- return dest;
- }
posted @
2012-08-12 15:58
张兰云
阅读(
342)
评论()
编辑
收藏
举报