case_diffs.c (352B)
1 #include "case.h" 2 3 int case_diffs(char *s, char *t) 4 { 5 unsigned char x; 6 unsigned char y; 7 8 for (;;) { 9 x = *s++ - 'A'; 10 if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; 11 y = *t++ - 'A'; 12 if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; 13 if (x != y) break; 14 if (!x) break; 15 } 16 return ((int)(unsigned int) x) - ((int)(unsigned int) y); 17 }