aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/compat/memcmp.c
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-10-05 23:44:31 +0200
committerRiccardo Spagni <ric@spagni.net>2014-10-05 23:44:31 +0200
commit9ef094b356b4da7542c3cab898dac7e135b76903 (patch)
tree99b5876712b0b1551fc042fe75447b998e4b0fc1 /external/unbound/compat/memcmp.c
parentsplit mnemonic printout over 3 lines (diff)
downloadmonero-9ef094b356b4da7542c3cab898dac7e135b76903.tar.xz
added unbound to external deps
Diffstat (limited to 'external/unbound/compat/memcmp.c')
-rw-r--r--external/unbound/compat/memcmp.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/external/unbound/compat/memcmp.c b/external/unbound/compat/memcmp.c
new file mode 100644
index 000000000..9446276f4
--- /dev/null
+++ b/external/unbound/compat/memcmp.c
@@ -0,0 +1,25 @@
+/*
+ * memcmp.c: memcmp compat implementation.
+ *
+ * Copyright (c) 2010, NLnet Labs. All rights reserved.
+ *
+ * See LICENSE for the license.
+*/
+
+#include <config.h>
+
+int memcmp(const void *x, const void *y, size_t n);
+
+int memcmp(const void *x, const void *y, size_t n)
+{
+ const uint8_t* x8 = (const uint8_t*)x;
+ const uint8_t* y8 = (const uint8_t*)y;
+ size_t i;
+ for(i=0; i<n; i++) {
+ if(x8[i] < y8[i])
+ return -1;
+ else if(x8[i] > y8[i])
+ return 1;
+ }
+ return 0;
+}