From 220534453eecc2c07ad710d72268aafd20b83138 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 8 May 2015 23:07:47 -0400 Subject: initial commit --- byte_diff.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 byte_diff.c (limited to 'byte_diff.c') 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 @@ +/* Public domain. */ + +#include "byte.h" + +int byte_diff(s,n,t) +register char *s; +register unsigned int n; +register char *t; +{ + for (;;) { + if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; + if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; + if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; + if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; + } + return ((int)(unsigned int)(unsigned char) *s) + - ((int)(unsigned int)(unsigned char) *t); +} -- cgit v1.2.3