source:
trunk/sys/dietlibc/memmove.c
@
193
| Last change on this file since 193 was 1, checked in by , 9 years ago | |
|---|---|
| File size: 382 bytes | |
| Line | |
|---|---|
| 1 | #define _POSIX_SOURCE |
| 2 | #define _XOPEN_SOURCE |
| 3 | #include <sys/types.h> |
| 4 | #include <string.h> |
| 5 | |
| 6 | void *memmove(void *dst, const void *src, size_t count) |
| 7 | { |
| 8 | char *a = dst; |
| 9 | const char *b = src; |
| 10 | if (src!=dst) |
| 11 | { |
| 12 | if (src>dst) |
| 13 | { |
| 14 | while (count--) *a++ = *b++; |
| 15 | } |
| 16 | else |
| 17 | { |
| 18 | a+=count-1; |
| 19 | b+=count-1; |
| 20 | while (count--) *a-- = *b--; |
| 21 | } |
| 22 | } |
| 23 | return dst; |
| 24 | } |
Note: See TracBrowser
for help on using the repository browser.
