views:

51

answers:

2

Hi, 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  
+2  A: 
#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
Graham Lee
+2  A: 
#ifdef __LP64__
// 64-bit code
#else
// 32-bit code
#endif

Source: http://developer.apple.com/mac/library/documentation/Darwin/Conceptual/64bitPorting/MakingCode64-BitClean/MakingCode64-BitClean.html#//apple_ref/doc/uid/TP40001064-CH226-SW2

swegi
Thanks, I was looking for that document! ;)
nacho4d