mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
cpuinfo: more robust ARM preprocessor checks.
This commit is contained in:
parent
35430a73f2
commit
5c6b2ebf2d
@ -50,11 +50,11 @@
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__) && defined(__ARM_ARCH)
|
||||||
#include <cpu-features.h>
|
#include <cpu-features.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__LINUX__) && HAVE_GETAUXVAL
|
#if defined(__LINUX__) && defined(__ARM_ARCH) && HAVE_GETAUXVAL
|
||||||
#include <sys/auxv.h>
|
#include <sys/auxv.h>
|
||||||
#include <asm/hwcap.h>
|
#include <asm/hwcap.h>
|
||||||
#endif
|
#endif
|
||||||
@ -312,12 +312,12 @@ CPU_haveNEON(void)
|
|||||||
const int error = sysctlbyname("hw.optional.neon", &neon, &length, NULL, 0);
|
const int error = sysctlbyname("hw.optional.neon", &neon, &length, NULL, 0);
|
||||||
if (!error)
|
if (!error)
|
||||||
neon = (neon != 0);
|
neon = (neon != 0);
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__) && defined(__ARM_ARCH)
|
||||||
if ( (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) &&
|
if ( (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) &&
|
||||||
((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) ) {
|
((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) ) {
|
||||||
neon = 1;
|
neon = 1;
|
||||||
}
|
}
|
||||||
#elif defined(__LINUX__) && HAVE_GETAUXVAL && defined(__arm__)
|
#elif defined(__LINUX__) && defined(__ARM_ARCH) && HAVE_GETAUXVAL
|
||||||
if (getauxval(AT_HWCAP) & HWCAP_NEON) {
|
if (getauxval(AT_HWCAP) & HWCAP_NEON) {
|
||||||
neon = 1;
|
neon = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user