Determine if the device is ARM64

落爺英雄遲暮 提交于 2019-12-02 02:04:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!