1 #include <lib9.h> 2 3 int memcmp(void * a1,void * a2,ulong n)4memcmp(void *a1, void *a2, ulong n) 5 { 6 uchar *s1, *s2; 7 uint c1, c2; 8 9 s1 = a1; 10 s2 = a2; 11 while(n > 0) { 12 c1 = *s1++; 13 c2 = *s2++; 14 if(c1 != c2) { 15 if(c1 > c2) 16 return 1; 17 return -1; 18 } 19 n--; 20 } 21 return 0; 22 } 23