]> git.sur5r.net Git - openldap/commitdiff
8-bit memcmp()
authorKurt Zeilenga <kurt@openldap.org>
Wed, 4 Nov 1998 18:47:15 +0000 (18:47 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 4 Nov 1998 18:47:15 +0000 (18:47 +0000)
libraries/liblutil/memcmp.c [new file with mode: 0644]

diff --git a/libraries/liblutil/memcmp.c b/libraries/liblutil/memcmp.c
new file mode 100644 (file)
index 0000000..b2c575d
--- /dev/null
@@ -0,0 +1,19 @@
+#include "portable.h"
+
+#include <ac/string.h>
+
+/* 
+ * Memory Compare
+ */
+int
+memcmp(const void *v1, const void *v2, int n) 
+{
+    if (n != 0) {
+               register const unsigned char *s1=v1, *s2=v2;
+        do {
+            if (*s1++ != *s2++)
+                return (*--s1 - *--s2);
+        } while (--n != 0);
+    }
+    return (0);
+}