byte_diff.c (464B)
1 /* Public domain. */ 2 3 #include "byte.h" 4 5 int byte_diff( register char* s, register size_t n, register char* t ) 6 { 7 for (;;) { 8 if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; 9 if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; 10 if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; 11 if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; 12 } 13 return ((int)(unsigned int)(unsigned char) *s) 14 - ((int)(unsigned int)(unsigned char) *t); 15 }