问题
I'm trying to make a tweak for iOS 7 so that when a device is ARM64 it runs one version and when it is not it runs another (since float is for 32 bit and double is for 64 (If you have a solution for that let me know.)
So it would be like this
if ARM64 {
\\run double code
}
else {
\\run float code
}
回答1:
You would do the following
#if __LP64__
\\You're running on 64 bit
#else
\\You're running on 32 bit
#endif
回答2:
On arm64 environment, the pointer take 8 bytes.
- (BOOL)isArm64
{
static BOOL arm64 = NO ;
static dispatch_once_t once ;
dispatch_once(&once, ^{
arm64 = sizeof(int *) == 8 ;
});
return arm64 ;
}
回答3:
Looking at the "arm_neon.h" header file, I can see that it is checking the preprocessor directive __arm64
. This is on Xcode 6.1.
In addition to that, some ARM NEON intrinsics available on older ARM (32-bit) architectures are not available on ARM64, or are replaced by equivalents which go by a slightly different name.
In particular, vtbl2
is replaced by vtbl1q
, because the underlying architecture has emphasized more on 128-bit NEON registers.
If you have some ARM NEON assembly code that don't compile under ARM64, try look up for changes such as this.
来源:https://stackoverflow.com/questions/21639128/determine-if-the-device-is-arm64