diff options
Diffstat (limited to 'byte_diff.c')
| -rw-r--r-- | byte_diff.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/byte_diff.c b/byte_diff.c new file mode 100644 index 0000000..cdbd760 --- /dev/null +++ b/byte_diff.c | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #include "byte.h" | ||
| 2 | |||
| 3 | int byte_diff(s,n,t) | ||
| 4 | register char *s; | ||
| 5 | register unsigned int n; | ||
| 6 | register char *t; | ||
| 7 | { | ||
| 8 | for (;;) { | ||
| 9 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||
| 10 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; | ||
| 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 | } | ||
| 14 | return ((int)(unsigned int)(unsigned char) *s) | ||
| 15 | - ((int)(unsigned int)(unsigned char) *t); | ||
| 16 | } | ||
