From 220534453eecc2c07ad710d72268aafd20b83138 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 8 May 2015 23:07:47 -0400 Subject: initial commit --- str_diff.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 str_diff.c (limited to 'str_diff.c') diff --git a/str_diff.c b/str_diff.c new file mode 100644 index 0000000..47dff22 --- /dev/null +++ b/str_diff.c @@ -0,0 +1,17 @@ +/* Public domain. */ + +#include "str.h" + +int str_diff(register const char *s,register const char *t) +{ + register char x; + + for (;;) { + x = *s; if (x != *t) break; if (!x) break; ++s; ++t; + x = *s; if (x != *t) break; if (!x) break; ++s; ++t; + x = *s; if (x != *t) break; if (!x) break; ++s; ++t; + x = *s; if (x != *t) break; if (!x) break; ++s; ++t; + } + return ((int)(unsigned int)(unsigned char) x) + - ((int)(unsigned int)(unsigned char) *t); +} -- cgit v1.2.3