From c601dacf310fa816365aaec814bf48c911cb6e62 Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 13 Jan 2017 22:01:45 +0300 Subject: [PATCH] arm64 compile fix --- contrib/libzookeeper/src/mt_adaptor.c | 5 ++++- libs/libcommon/include/common/find_first_symbols.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/libzookeeper/src/mt_adaptor.c b/contrib/libzookeeper/src/mt_adaptor.c index e74543d8ad8..0d6a05d159d 100644 --- a/contrib/libzookeeper/src/mt_adaptor.c +++ b/contrib/libzookeeper/src/mt_adaptor.c @@ -484,7 +484,10 @@ int32_t inc_ref_counter(zhandle_t* zh,int i) int32_t fetch_and_add(volatile int32_t* operand, int incr) { -#ifndef WIN32 +#if defined(__ARM_ARCH) + // this is gcc-specific func https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/_005f_005fatomic-Builtins.html + return __atomic_fetch_add(operand, incr, __ATOMIC_RELAXED); +#elif !defined(WIN32) int32_t result; asm __volatile__( "lock xaddl %0,%1\n" diff --git a/libs/libcommon/include/common/find_first_symbols.h b/libs/libcommon/include/common/find_first_symbols.h index 7d8ce073411..52ae6951ea6 100644 --- a/libs/libcommon/include/common/find_first_symbols.h +++ b/libs/libcommon/include/common/find_first_symbols.h @@ -35,6 +35,7 @@ inline bool is_in(char x) return x == s0 || is_in(x); } +#if defined(__x86_64__) template inline __m128i mm_is_in(__m128i bytes) { @@ -49,6 +50,7 @@ inline __m128i mm_is_in(__m128i bytes) __m128i eq = mm_is_in(bytes); return _mm_or_si128(eq0, eq); } +#endif template