summaryrefslogtreecommitdiff
path: root/crc32c.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2021-06-08 12:58:44 -0700
committerdormando <dormando@rydia.net>2021-06-08 12:58:44 -0700
commit4481e4c831dc79058f9ce83046e1d6c53f14b912 (patch)
treec72d09757f94472a643823f94b860cab93061c64 /crc32c.c
parent0f1763499e015fe5f6c1bd33430359d8bc4708c3 (diff)
downloadmemcached-4481e4c831dc79058f9ce83046e1d6c53f14b912.tar.gz
fix arm64 crc32 on old glibc/gcc.
patch by @sergey-dryabzhinsky on github, but he deleted the repo so I rewrote the commit.
Diffstat (limited to 'crc32c.c')
-rw-r--r--crc32c.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crc32c.c b/crc32c.c
index 916e0e6..26df879 100644
--- a/crc32c.c
+++ b/crc32c.c
@@ -276,6 +276,7 @@ void crc32c_init(void) {
#elif defined(__aarch64__) && defined(__linux__)
#include <sys/auxv.h>
+#if defined(HWCAP_CRC32)
static inline uint32_t crc32cx(uint32_t crc, const uint64_t data)
{
asm(".arch_extension crc\n"
@@ -336,6 +337,11 @@ void crc32c_init(void) {
if (auxv & HWCAP_CRC32)
crc32c = crc32c_hw;
}
+#else /* no hw crc32 on arm64 system supported? old compiler/libc/kernel? */
+void crc32c_init(void) {
+ crc32c = crc32c_sw;
+}
+#endif
#else /* !__x86_64__i && !__aarch64__ */
void crc32c_init(void) {
crc32c = crc32c_sw;