Version: 1.5.3 -> 1.5.4cvs
[mdsms.git] / memmove.c
1 #include "config.h"
2 #ifndef lint
3 static char rcsid[] ATTR_UNUSED = "$Id$";
4 #endif
5
6 /* This part of code is a public domain */
7
8 /* CONFORMING TO SVID 3, BSD 4.3, ISO 9899 */
9
10 void *memmove(void *dest, const void *src, size_t n)
11 {
12 char *cdest,*csrc;
13
14         if (dest==src || !n) return;
15         cdest=dest; csrc=src;
16         if (dest<src) {
17                 while (n--) *cdest++=*csrc++;
18         } else {
19                 cdest+=n; csrc+=n;
20                 while (n--) *--cdest=*--csrc;
21                 }
22 }