summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2017-02-19 14:01:58 +0000
committerSalvatore Sanfilippo <antirez@gmail.com>2017-02-19 14:01:58 +0000
commit1e272a6b52d663e0b4db8f42162c4461405b7f84 (patch)
tree0fe9caf5b5c3489539f9cca599f101e80a42c10e /src
parentf917e0da4cda8a0e6cd3242180b268706cdd2dd2 (diff)
downloadredis-1e272a6b52d663e0b4db8f42162c4461405b7f84.tar.gz
ARM: Fix 64 bit unaligned access in MurmurHash64A().
Diffstat (limited to 'src')
-rw-r--r--src/config.h6
-rw-r--r--src/hyperloglog.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/config.h b/src/config.h
index 9fd53626e..354f8f5e5 100644
--- a/src/config.h
+++ b/src/config.h
@@ -206,4 +206,10 @@ void setproctitle(const char *fmt, ...);
#endif
#endif
+/* Make sure we can test for ARM just checking for __arm__, since sometimes
+ * __arm is defined but __arm__ is not. */
+#if defined(__arm) && !defined(__arm__)
+#define __arm__
+#endif
+
#endif
diff --git a/src/hyperloglog.c b/src/hyperloglog.c
index 0800bf59d..7de5786f9 100644
--- a/src/hyperloglog.c
+++ b/src/hyperloglog.c
@@ -401,7 +401,11 @@ uint64_t MurmurHash64A (const void * key, int len, unsigned int seed) {
uint64_t k;
#if (BYTE_ORDER == LITTLE_ENDIAN)
+ #ifdef __arm__
+ memcpy(&k,data,sizeof(uint64_t));
+ #else
k = *((uint64_t*)data);
+ #endif
#else
k = (uint64_t) data[0];
k |= (uint64_t) data[1] << 8;