Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# missing/memmove.c

Go to the documentation of this file.

    00001 /* public domain rewrite of memcmp(3) */
    00002
    00003 #include <stddef.h>
    00004
    00005 void *
    00006 memmove(void *d, const void *s, size_t n)
    00007 {
    00008     char *dst = (char *)d;
    00009     const char *src = (const char *)s;
    00010
    00011     if (src < dst) {
    00012         src += n;
    00013         dst += n;
    00014         for (; n; --n)
    00015             *--dst = *--src;
    00016     }
    00017     else if (dst < src)
    00018         for (; n; --n)
    00019             *dst++ = *src++;
    00020     return d;
    00021 }
    00022