summaryrefslogtreecommitdiff
path: root/byte_diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'byte_diff.c')
-rw-r--r--byte_diff.c18
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
5int byte_diff(s,n,t)
6register char *s;
7register unsigned int n;
8register 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}