aboutsummaryrefslogtreecommitdiff
path: root/djb/byte_diff.c
diff options
context:
space:
mode:
authorKlaatu <[email protected]>2015-05-17 15:33:21 +1200
committerKlaatu <[email protected]>2015-05-17 15:33:21 +1200
commitb0de699679e8f1e39af847ed172d1ba605b4370c (patch)
tree01dac00471d61f727394e508c613b29cff0ceae5 /djb/byte_diff.c
bulk upload of source
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;
+}