scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

memcmp.c (206B)


      1 #include <string.h>
      2 #undef memcmp
      3 
      4 int
      5 memcmp(const void *s1, const void *s2, size_t n)
      6 {
      7 	char *s = (char *) s1, *t = (char *) s2;
      8 
      9 	while (n > 0 && *s == *t)
     10 		--n, ++s, ++t;
     11 	return n ? (*s - *t) : 0;
     12 }