Skip to content

Commit

Permalink
cpuinfo: more robust ARM preprocessor checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Nov 17, 2016
1 parent 35430a7 commit 5c6b2eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cpuinfo/SDL_cpuinfo.c
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 5c6b2eb

Please sign in to comment.