scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

memmove.c (259B)


      1 #include <string.h>
      2 #undef memmove
      3 
      4 void *
      5 memmove(void *dst, const void *src, size_t n)
      6 {
      7 	char *d = dst, *s = (char *) src;
      8 
      9 	if (d < s) {
     10 		while (n-- > 0)
     11 			*d++ = *s++;
     12 	} else {
     13 		s += n-1, d += n-1;
     14 		while (n-- > 0)
     15 			*d-- = *s--;
     16 	}
     17 	return dst;
     18 }