how to tell 64 vs 32 bit architecture ?

Luigi Rizzo rizzo at icir.org
Fri Sep 7 00:11:59 PDT 2007


On Fri, Sep 07, 2007 at 01:26:47AM +0300, Giorgos Keramidas wrote:
> On 2007-09-06 11:10, Luigi Rizzo <rizzo at icir.org> wrote:
> > hi,
> > i was wondering what is the proper way to tell a 64 vs 32 bit
> > architecture.
> >
> > I see that some code in sys/ uses  ' #ifdef __LP64__ ' but i am not
> > sure if this is generic enough (ie not gcc or FreeBSD specific),
> > and also suitable for userland (i.e. works on linux or other platforms
> > as well).
> 
> This is usually needed to differentiate between a feature "X" which
> behaves differently in amd64 vs. i386 vs. sparc vs. sparc64, etc.

i am actually looking at pointer sizes, as i need to do some pointer
manipulation going through intptr_t, and need to know that in the
preprocessor because some constants need to be 32 or 64 bit depending
on that, and are not trivial (i.e. not 0, 1 or something i can build
with size-agnostic expressions)

cheers
luigi


More information about the freebsd-current mailing list