29 | | #ifdef NEED_MEMMOVE |
30 | | # if USE_PROTOTYPES |
31 | | void *memmove(void *dest, const void *src, size_t size) |
32 | | # else /* don't USE_PROTOTYPES */ |
33 | | void *memmove(dest, src, size) |
34 | | void *dest; |
35 | | void *src; |
36 | | size_t size; |
37 | | # endif /* don't USE_PROTOTYPES */ |
38 | | { |
39 | | register char *d, *s; |
40 | | |
41 | | d = (char *)dest; |
42 | | s = (char *)src; |
43 | | if (d <= s) |
44 | | { |
45 | | for (; size > 0; size--) |
46 | | *d++ = *s++; |
47 | | } |
48 | | else |
49 | | { |
50 | | for (d += size, s += size; size > 0; size--) |
51 | | *--d = *--s; |
52 | | } |
53 | | return dest; |
54 | | } |
55 | | #endif |
56 | | |