steinwurf / cpuid

C++ library for detecting CPU capabilities
https://cpuid.steinwurf.com
Other
105 stars 21 forks source link

Fix ios #8

Closed petya2164 closed 10 years ago

petya2164 commented 10 years ago

@nestorjhernandezm @mortenvp @jpihl I used a compile-time check to determine NEON support on iOS. Runtime checking does not make sense on this platform, because the compiler "guarantees" NEON support on the target device if the ARM_NEON flag is defined. In other words: the toolchain configuration (cpu=armv7) determines this question, not the device. All iOS devices support NEON since the 3rd gen iPod Touch (and we have that one). I will merge this now, and we can add a different solution if the need arises later. I also removed the debug prints and fixed all warnings. Anyway, CPUID is all green now!

nestorjhernandezm commented 10 years ago

Hi @petya2164 !

Great! Actually it's easier to check in this way than with /proc/self/auxv ... If the compiler has defined this macro, makes sense to use it :+1: what do you think @mortenvp and @jpihl ?

mortenvp commented 10 years ago

In general it will not work to rely on the compiler macros - you need run time detection. If we can for a specific platform know that it will always be NEON e.g. the iOS - then ok for that specific case it will work. But ones there are multiple CPU types with different capabilities you need the runtime check.