1 1.1.1.1.8.2 tls /* Public domain. */ 2 1.1.1.1.8.2 tls #include <stddef.h> 3 1.1.1.1.8.2 tls 4 1.1.1.1.8.2 tls int 5 1.1.1.1.8.2 tls memcmp (const void *str1, const void *str2, size_t count) 6 1.1.1.1.8.2 tls { 7 1.1.1.1.8.2 tls const unsigned char *s1 = str1; 8 1.1.1.1.8.2 tls const unsigned char *s2 = str2; 9 1.1.1.1.8.2 tls 10 1.1.1.1.8.2 tls while (count-- > 0) 11 1.1.1.1.8.2 tls { 12 1.1.1.1.8.2 tls if (*s1++ != *s2++) 13 1.1.1.1.8.2 tls return s1[-1] < s2[-1] ? -1 : 1; 14 1.1.1.1.8.2 tls } 15 1.1.1.1.8.2 tls return 0; 16 1.1.1.1.8.2 tls } 17