Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# missing/memcmp.c

Go to the documentation of this file.

    00001 /* public domain rewrite of memcmp(3) */
    00002
    00003 #include <stddef.h>
    00004
    00005 int
    00006 memcmp(const void *s1, const void *s2, size_t len)
    00007 {
    00008     register unsigned char *a = (unsigned char*)s1;
    00009     register unsigned char *b = (unsigned char*)s2;
    00010     register int tmp;
    00011
    00012     for (; len; --len) {
    00013         if (tmp = *a++ - *b++)
    00014             return tmp;
    00015     }
    00016     return 0;
    00017 }
    00018