how to know if current architecture is i386 or x86_64 in macs? (Xcode)

前端 未结 2 1344
广开言路
广开言路 2021-01-06 00:31

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

2条回答
  •  攒了一身酷
    2021-01-06 01:03

    #ifdef __x86_64__
      //64-bit intel
    #endif
    #ifdef __i386__
      //32-bit intel
    #endif
    //carry on for ppc, ppc64, ARM
    

    or...

    #ifdef __LP64__
      //64-bit Intel or PPC
    #else
      //32-bit Intel, PPC or ARM
    #endif
    

提交回复
热议问题