summaryrefslogtreecommitdiff
path: root/str_diff.c
blob: 47dff2258f27ad1045ea3243f6cea1538d90c4c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* Public domain. */

#include "str.h"

int str_diff(register const char *s,register const char *t)
{
  register char x;

  for (;;) {
    x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
    x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
    x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
    x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
  }
  return ((int)(unsigned int)(unsigned char) x)
       - ((int)(unsigned int)(unsigned char) *t);
}