2013-05-27 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libgcc / memmove.c
blob13b340af6a01171d21a17f04482cfcc814080e97
1 /* Public domain. */
2 #include <stddef.h>
4 void *
5 memmove (void *dest, const void *src, size_t len)
7 char *d = dest;
8 const char *s = src;
9 if (d < s)
10 while (len--)
11 *d++ = *s++;
12 else
14 char *lasts = s + (len-1);
15 char *lastd = d + (len-1);
16 while (len--)
17 *lastd-- = *lasts--;
19 return dest;