From 3289aad8bd6a9b8b8e9f9491234c66160fbf6164 Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 7 Mar 2014 03:37:57 +0100 Subject: Tweaked a platform check to support ARMv6+ Signed-off-by: Haru --- src/common/atomic.h | 4 +++- src/common/cbasetypes.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/atomic.h b/src/common/atomic.h index c2227a9d4..8c01943e7 100644 --- a/src/common/atomic.h +++ b/src/common/atomic.h @@ -87,7 +87,9 @@ forceinline volatile int64 InterlockedExchange64(volatile int64 *target, int64 v #elif defined(__GNUC__) -#if !defined(__x86_64__) && !defined(__i386__) +// The __sync functions are available on x86 or ARMv6+ +#if !defined(__x86_64__) && !defined(__i386__) \ + && ( !defined(__ARM_ARCH_VERSION__) || __ARM_ARCH_VERSION__ < 6 ) #error Your Target Platfrom is not supported #endif diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index 654334a9b..f44e80413 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -42,6 +42,18 @@ #define __DARWIN__ #endif +// Standardize the ARM platform version, if available (the only values we're interested in right now are >= ARMv6) +#if defined(__ARMV6__) || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) \ + || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) // gcc ARMv6 +#define __ARM_ARCH_VERSION__ 6 +#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7S__) // gcc ARMv7 +#define __ARM_ARCH_VERSION__ 7 +#elif defined(_M_ARM) // MSVC +#define __ARM_ARCH_VERSION__ _M_ARM +#else +#define __ARM_ARCH_VERSION__ 0 +#endif + // Necessary for __NetBSD_Version__ (defined as VVRR00PP00) on NetBSD #ifdef __NETBSD__ #include -- cgit v1.2.3-60-g2f50