diff options
author | joe <joe@jerkface.net> | 2015-05-08 23:07:47 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2015-05-08 23:07:47 -0400 |
commit | 220534453eecc2c07ad710d72268aafd20b83138 (patch) | |
tree | 469bd5db135e31b7ea908152aa3389b9b1e06d5b /byte_diff.c |
initial commit
Diffstat (limited to 'byte_diff.c')
-rw-r--r-- | byte_diff.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/byte_diff.c b/byte_diff.c new file mode 100644 index 0000000..0c4d17b --- /dev/null +++ b/byte_diff.c | |||
@@ -0,0 +1,18 @@ | |||
1 | /* Public domain. */ | ||
2 | |||
3 | #include "byte.h" | ||
4 | |||
5 | int byte_diff(s,n,t) | ||
6 | register char *s; | ||
7 | register unsigned int n; | ||
8 | register char *t; | ||
9 | { | ||
10 | for (;;) { | ||
11 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||
12 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||
13 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||
14 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||
15 | } | ||
16 | return ((int)(unsigned int)(unsigned char) *s) | ||
17 | - ((int)(unsigned int)(unsigned char) *t); | ||
18 | } | ||