[NCLUG] simple way to determine 32 or 64 bit?

Michael Dwyer mdwyer at sixthdimension.com
Mon Jun 11 14:28:59 MDT 2001


> > Like mine says "Pentium III (Coppermine)" and I know that's
> > a 32-bit IA32 (or 36 or whatever-the-heck, sue me) cpu.
> > Just put together a compendium mapping all CPU+stepping
> > data to instruction-width and data-width for all known
> > processors.
>
>  Which all breaks with the inevitable kernel "make config" option
asking
> if you'd like to compile this as a 32-bit or a 64-bit kernel. :-P
>
> > Can't be any worse than Windows-version detection. :-(
>
>  Or browser detection...

Is it reasonable to try looking in an #include file, like limits.h or
something to see what size a long is or something?
/usr/include/linux/asm/* has arch-specific stuff in it, but I can't
find anything specific yet...

In fact, it appears that there isn't really a single flag to tell
bittness of a machine.  (I just made up that word.  I'm so proud.)  They
MIPS code, for instance, has some code (to paraphrase):

/* use only for 64 bit arch */
if MIPS_CPU == MIPS_CPU_4000 || MIPS_CPU== ....

and so on.  Hrm.  It /looks/ like a table of processor ID's is the only
way to do it right now. :(

(The Linux Kernel list may know better.  At least I hope they do...)


Doesn't the ./configure script do a 32/64 test sometimes?  How would you
do it?  What would compile differently between a 32/64 machine that you
could test for?





More information about the NCLUG mailing list