summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2017-02-23 22:39:44 +0800
committerSalvatore Sanfilippo <antirez@gmail.com>2017-02-23 22:39:44 +0800
commitb3391fd853d55b3da04ede024adcc6bf017c78f1 (patch)
tree4901d1a9b129dcf61d8677debc639180d8e6c411
parentd7826823c05ad82f710da74c3d5d402898187888 (diff)
downloadredis-b3391fd853d55b3da04ede024adcc6bf017c78f1.tar.gz
Use ARM unaligned accesses ifdefs for SPARC as well.
-rw-r--r--src/bitops.c2
-rw-r--r--src/config.h9
-rw-r--r--src/hyperloglog.c2
3 files changed, 11 insertions, 2 deletions
diff --git a/src/bitops.c b/src/bitops.c
index d5b96ce1e..43450fca3 100644
--- a/src/bitops.c
+++ b/src/bitops.c
@@ -665,7 +665,7 @@ void bitopCommand(client *c) {
* result in GCC compiling the code using multiple-words load/store
* operations that are not supported even in ARM >= v6. */
j = 0;
- #ifndef __arm__
+ #ifndef USE_ALIGNED_ACCESS
if (minlen >= sizeof(unsigned long)*4 && numkeys <= 16) {
unsigned long *lp[16];
unsigned long *lres = (unsigned long*) res;
diff --git a/src/config.h b/src/config.h
index 1005dcc2a..c23f1c789 100644
--- a/src/config.h
+++ b/src/config.h
@@ -215,4 +215,13 @@ void setproctitle(const char *fmt, ...);
#define __arm64__
#endif
+/* Make sure we can test for SPARC just checking for __sparc__. */
+#if defined(__sparc) && !defined(__sparc__)
+#define __sparc__
+#endif
+
+#if defined(__sparc__) || defined(__arm__)
+#define USE_ALIGNED_ACCESS
+#endif
+
#endif
diff --git a/src/hyperloglog.c b/src/hyperloglog.c
index b8a63a73f..49516f824 100644
--- a/src/hyperloglog.c
+++ b/src/hyperloglog.c
@@ -401,7 +401,7 @@ uint64_t MurmurHash64A (const void * key, int len, unsigned int seed) {
uint64_t k;
#if (BYTE_ORDER == LITTLE_ENDIAN)
- #if defined(__arm__) && !defined(__arm64__)
+ #ifdef USE_ALIGNED_ACCESS
memcpy(&k,data,sizeof(uint64_t));
#else
k = *((uint64_t*)data);