[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to find out if an architecture is 32 or 64 bit?



Hi,

I'm lookking for my package tmview for a C solution to determine whether
an architecture is 32 or 64 bit.

The current code is:

<--  snip  -->

#define BMLONG32       /* for architectures where "long int" has 32bits,
                          e.g. i386  */
/* #define BMLONG64  *//* for architectures where "long int" has 64bits,
                          e.g. alpha */

...

#ifdef  BMLONG64
#define BMUNIT                  unsigned long
#define BITS_PER_BMUNIT         64
#define BITS_LOG2               6
#define BYTES_PER_BMUNIT        8
#endif
#ifdef  BMLONG32
#define BMUNIT                  unsigned long
#define BITS_PER_BMUNIT         32
#define BITS_LOG2               5
#define BYTES_PER_BMUNIT        4
#endif

<--  snip  -->

Could anyone point me to a better way to handle this?


Thanks in advance
Adrian

PS: Please Cc me since I'm not on this list.


-- 

Nicht weil die Dinge schwierig sind wagen wir sie nicht,
sondern weil wir sie nicht wagen sind sie schwierig.



Reply to: