如何知道Mac中当前的体系结构是i386还是x86_64? (Xcode) [英] how to know if current architecture is i386 or x86_64 in macs? (Xcode)

查看:816
本文介绍了如何知道Mac中当前的体系结构是i386还是x86_64? (Xcode)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理在不同体系结构中需要不同参数的相机,是否可以检查标志以查看我的Mac是32位还是64位? 我正在尝试这样做,但似乎无法正常工作,我总是得到32Bits !! :

I am handling a camera that needs different parameters in different architecture, Is there a flag that I can check to see if I am in 32bits or 64bits in my mac? I was trying this but does not seem to work, I always get 32Bits!! :

#if defined(PER_ARCH_CFLAGS_x86_64)
    NSLog(@"64bit!!");
#else 
    NSLog(@"32Bits!!");
#endif  

推荐答案

#ifdef __LP64__
// 64-bit code
#else
// 32-bit code
#endif

来源: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆