This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: UNITS vs. BYTES


Adrian Prantl wrote:
Hello everybody,

I am currently working on creating a new gcc backend for a word-addressable
machine with 24-Bit general purpose registers.
While doing so I came across a few inconsistencies regarding the usage of the
BITS_PER_UNIT Macro. (and UNITS_PER_WORD, in a related story)

Apparently a lot of places in the gcc sources use the concept of a UNIT
where they actually mean an 8-Bit Byte and vice versa. (often in the form
of bytelen*BITS_PER_UNITS in order to calculate some size in BITS)

Old alphas are word-addressable, but still they had BITS_PER_UNIT == 8.


Or you may want to look at the c4x back-end, which has

/* Note the ANSI C standard requires sizeof(char) = 1.  On the C[34]x
   all integral and floating point data types are stored in memory as
   32-bits (floating point types can be stored as 40-bits in the
   extended precision registers), so sizeof(char) = sizeof(short) =
   sizeof(int) = sizeof(long) = sizeof(float) = sizeof(double) = 1.  */

#define BITS_PER_UNIT           32
#define UNITS_PER_WORD          1

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]