Date: Fri, 7 Sep 2007 16:21:09 +0200 From: Fabio Checconi <fabio@freebsd.org> To: Luigi Rizzo <rizzo@icir.org> Cc: Giorgos Keramidas <keramida@ceid.upatras.gr>, current@freebsd.org Subject: Re: how to tell 64 vs 32 bit architecture ? Message-ID: <20070907142109.GL30045@gandalf.sssup.it> In-Reply-To: <20070907050310.A94579@xorpc.icir.org> References: <20070906111028.A83649@xorpc.icir.org> <20070906222647.GB2737@kobe.laptop> <20070907000950.A91211@xorpc.icir.org> <20070907115021.GA2718@kobe.laptop> <20070907050310.A94579@xorpc.icir.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070907142109.GL30045>