aboutsummaryrefslogtreecommitdiff
path: root/djb/byte_diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'djb/byte_diff.c')
-rw-r--r--djb/byte_diff.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/djb/byte_diff.c b/djb/byte_diff.c
new file mode 100644
index 0000000..6ad0a13
--- /dev/null
+++ b/djb/byte_diff.c
@@ -0,0 +1,11 @@
+int byte_diff(const void* a, unsigned int len, const void* b) /*EXTRACT_INCL*/ {
+ char *x=(char *)a;
+ char *y=(char *)b;
+ unsigned int u=0;
+ char ch=0;
+ for (; u<len; u++) {
+ ch = x[u] - y[u];
+ if (ch) break;
+ }
+ return ch;
+}