Detect if build is 32 or 64 bit

42 views
Skip to first unread message

J Decker

unread,
Sep 14, 2017, 7:12:42 PM9/14/17
to gyp-developer
How do I detect if a build is 32 or 64 bit; mostly my code doesn't care these days... but it is sometimes needed to define __64__ for 64 bit builds.  In this case especially for mac.where kevent has two different structures.  

J Decker

unread,
Sep 14, 2017, 7:24:38 PM9/14/17
to gyp-developer
On Thursday, September 14, 2017 at 4:12:42 PM UTC-7, J Decker wrote:
How do I detect if a build is 32 or 64 bit; mostly my code doesn't care these days... but it is sometimes needed to define __64__ for 64 bit builds.  In this case especially for mac.where kevent has two different structures.  
Nevermind, I had code to check via predefined compiler symbols...
  • __i386__—Intel (32-bit)

  • __x86_64__—Intel (64-bit)

  • __ppc__—PowerPC (32-bit)

  • __ppc64__—PowerPC (64-bit)

  • __BIG_ENDIAN__—Big endian CPU

  • __LITTLE_ENDIAN__—Little endian CPU

  • __LP64__—The LP64 (64-bit) data model

 
Reply all
Reply to author
Forward
0 new messages