From 225bcae3e7bf944d0740609dd331e08900ae4161 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 23 Jun 2014 07:36:38 -0700 Subject: [PATCH] Flesh out mdb_cmp_cint for BigEndians --- libraries/liblmdb/mdb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index efd15e5bea..d2e4b2ca17 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -4610,7 +4610,16 @@ mdb_cmp_cint(const MDB_val *a, const MDB_val *b) } while(!x && u > (unsigned short *)a->mv_data); return x; #else - return memcmp(a->mv_data, b->mv_data, a->mv_size); + unsigned short *u, *c, *end; + int x; + + end = (unsigned short *) ((char *) a->mv_data + a->mv_size); + u = (unsigned short *)a->mv_data; + c = (unsigned short *)b->mv_data; + do { + x = *u++ - *c++; + } while(!x && u < end); + return x; #endif }