cpuinfo: more robust ARM preprocessor checks.

This commit is contained in:
Ryan C. Gordon 2016-11-17 01:26:56 -05:00
parent 35430a73f2
commit 5c6b2ebf2d
1 changed files with 4 additions and 4 deletions

View File

@ -50,11 +50,11 @@
#include <setjmp.h>
#endif
#if defined(__ANDROID__)
#if defined(__ANDROID__) && defined(__ARM_ARCH)
#include <cpu-features.h>
#endif
#if defined(__LINUX__) && HAVE_GETAUXVAL
#if defined(__LINUX__) && defined(__ARM_ARCH) && HAVE_GETAUXVAL
#include <sys/auxv.h>
#include <asm/hwcap.h>
#endif
@ -312,12 +312,12 @@ CPU_haveNEON(void)
const int error = sysctlbyname("hw.optional.neon", &neon, &length, NULL, 0);
if (!error)
neon = (neon != 0);
#elif defined(__ANDROID__)
#elif defined(__ANDROID__) && defined(__ARM_ARCH)
if ( (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) &&
((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) ) {
neon = 1;
}
#elif defined(__LINUX__) && HAVE_GETAUXVAL && defined(__arm__)
#elif defined(__LINUX__) && defined(__ARM_ARCH) && HAVE_GETAUXVAL
if (getauxval(AT_HWCAP) & HWCAP_NEON) {
neon = 1;
}