Related articles |
---|
64 bit integers ? larsn@autodesk.com (1993-03-04) |
Re: 64 bit integers ? jamey@juicy-juice.lcs.mit.edu (1993-03-09) |
Newsgroups: | comp.compilers |
From: | jamey@juicy-juice.lcs.mit.edu |
Keywords: | C, architecture |
Organization: | Compilers Central |
References: | 93-03-018 |
Date: | Tue, 9 Mar 1993 16:52:22 GMT |
In order to write portable and efficient code, don't use 'int', because
'int' is not portable if you care about its size.
Instead of int, we use
uint32_t, for unsigned 32 bit integers
sint32_t, for signed 32 bit integers
auint32_t, for an unsigned integer of at least 32 bits,
asint32_t, for a signed integer of at least 32 bits,
uint8_t
sint8_t
etc.
These types can all be defined in a single .h file that is conditionalized
for each architecture. The auint32_t type can be implemented as 32 or 64
bits depending on which is more efficient. Type uint32_t should be used
when it is necessary to use 32-bits even if 64 would be more efficient (if
that is ever the case).
-Jamey
----------------------------------------------------------
Dr. James Hicks jamey@mcrc.mot.com
Member of the Technical Staff
Motorola Cambridge Research Center
One Kendall Square, Building 200
Cambridge, MA 02139
(617) 621-0928
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.