1 #include <string.h> 2 3 #if defined(_MSC_VER) && (_MSC_VER >= 1910 || !defined(_WIN64)) 4 #pragma function(memmove) 5 #endif /* _MSC_VER */ 6 7 /* NOTE: This code is duplicated in memcpy function */ 8 void * __cdecl memmove(void *dest,const void *src,size_t count) 9 { 10 char *char_dest = (char *)dest; 11 char *char_src = (char *)src; 12 13 if ((char_dest <= char_src) || (char_dest >= (char_src+count))) 14 { 15 /* non-overlapping buffers */ 16 while(count > 0) 17 { 18 *char_dest = *char_src; 19 char_dest++; 20 char_src++; 21 count--; 22 } 23 } 24 else 25 { 26 /* overlaping buffers */ 27 char_dest = (char *)dest + count - 1; 28 char_src = (char *)src + count - 1; 29 30 while(count > 0) 31 { 32 *char_dest = *char_src; 33 char_dest--; 34 char_src--; 35 count--; 36 } 37 } 38 39 return dest; 40 } 41