nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

case_diffb.c (378B)


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