how to tell 64 vs 32 bit architecture ?
Fabio Checconi
fabio at freebsd.org
Fri Sep 7 08:21:24 PDT 2007
On Fri, Sep 07, 2007 at 05:03:10AM -0700, Luigi Rizzo wrote:
> i need to do this:
>
> #ifdef BUILT_FOR_64BIT_POINTERS
> #define MY_MAGIC 0xdeadbeefd00de123 /* 64 bit */
> #else
> #define MY_MAGIC 0xdeadbeef /* 32 bit */
>
> If you know of a way to implement this without preprocessor
> magic, i am all ears. If the values were simpler (eg all ones or so)
> i could have used ~((unitptr_t)0) but this is not the case here
#include <stdint.h>
#if UINTPTR_MAX < 0xdeadbeefd00de123 /* <= 0xffffffff */
#define MY_MAGIC 0xdeadbeef
#else
#define MY_MAGIC 0xdeadbeefd00de123
#endif
does something like that look good to you ?
fabio
More information about the freebsd-current
mailing list