64 bit architectures and C/C++

Doug Gwyn gwyn at smoke.brl.mil
Tue May 7 06:42:23 AEST 1991


In article <1991May4.202438.14664 at ux1.cso.uiuc.edu> phil at ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes:
>I want to pass around integer numbers that I know will require more than
>32 bits but not more than 63 bits.
>I want to specify it sufficiently that a reasonable implementation on a 64 bit
>machine will in fact use the 64 bit integer instructions.  Whatever way it
>is to be specified should work on all such 64 bit machines.

The question is, should it also work on non-64 bit architectures?
If not, just use "long".  If so, you'll need some fairly obvious type
definitions, macros, etc.  To automatically configure your code to
accommodate both types of architecture, you can make the definitions
conditional on some arithmetic property in the preprocessor that will
produce different results in the two environments; for example you
could test for sign extension of the 32nd bit.



More information about the Comp.lang.c mailing list