str_diffn.c
author tomas@localhost
Thu, 01 Nov 2007 14:46:11 +0100
changeset 0 c045670f36e9
permissions -rw-r--r--
Imported queue-fix-1.4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     1
#include "str.h"
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     2
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     3
int str_diffn(s,t,len)
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     4
register char *s;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     5
register char *t;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     6
unsigned int len;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     7
{
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     8
  register char x;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
     9
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    10
  for (;;) {
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    11
    if (!len--) return 0; x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    12
    if (!len--) return 0; x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    13
    if (!len--) return 0; x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    14
    if (!len--) return 0; x = *s; if (x != *t) break; if (!x) break; ++s; ++t;
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    15
  }
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    16
  return ((int)(unsigned int)(unsigned char) x)
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    17
       - ((int)(unsigned int)(unsigned char) *t);
c045670f36e9 Imported queue-fix-1.4
tomas@localhost
parents:
diff changeset
    18
}