1 /* memcmp -- compare two memory regions.
2 This function is in the public domain. */
6 memcmp -- compare two memory regions
9 int memcmp (const void *from, const void *to, size_t count)
12 Compare two memory regions and return less than,
13 equal to, or greater than zero, according to lexicographical
14 ordering of the compared regions.
21 #define size_t unsigned long
25 DEFUN(memcmp, (str1, str2, count),
26 const PTR str1 AND const PTR str2 AND size_t count)
28 register unsigned char *s1 = (unsigned char*)str1;
29 register unsigned char *s2 = (unsigned char*)str2;
34 return s1[-1] < s2[-1] ? -1 : 1;