* include/ruby/io.h (rb_io_t): new fields: writeconv,
[ruby-svn.git] / missing / memmove.c
blob19c5f18847ed8d4b3f436223a45ba2e2f33f0411
1 /* public domain rewrite of memcmp(3) */
3 #include <stddef.h>
5 void *
6 memmove(void *d, const void *s, size_t n)
8 char *dst = (char *)d;
9 const char *src = (const char *)s;
11 if (src < dst) {
12 src += n;
13 dst += n;
14 for (; n; --n)
15 *--dst = *--src;
17 else if (dst < src)
18 for (; n; --n)
19 *dst++ = *src++;
20 return d;