* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / missing / memcmp.c
blob5b3ad3817a5dece9e5ea2f1062a5ce86eba8c5e2
1 /* public domain rewrite of memcmp(3) */
3 #include <stddef.h>
5 int
6 memcmp(const void *s1, const void *s2, size_t len)
8 register unsigned char *a = (unsigned char*)s1;
9 register unsigned char *b = (unsigned char*)s2;
10 register int tmp;
12 for (; len; --len) {
13 if (tmp = *a++ - *b++)
14 return tmp;
16 return 0;