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]

Re: More on type sizes


> Now that I think about it, why do we need TYPE_SIZE *at all*?  The
> only place we currently allow a size not to be a multiple of
> BITS_PER_UNIT is the DECL_SIZE of a bitfield.  At some point, it would
> indeed be nice to support such things as bit-packed arrays, where we
> actually *do* have a type whose size is, say, 1 bit, but in that case
> what would TYPE_SIZE_UNIT mean?

When a size is caluclated in bytes, we want to use TYPE_SIZE so that we
get the expected overlow effects.
When a size is calculated in bits, we don't want them.
Note that not only the size, but also the offset of a bitfield has to
be expressed in single bits - unless we want to use a representation
as sum of a multiple of BITS_PER_UNIT plus a single-bit count that
is smaller than BITS_PER_UNIT.

The original problem that propted the introduction of bitsizetype
was actually not a 32 bit compilation, but a 32->16 bit cross compilation.
The way this 'worked' was so that a structure could not be as large as
4 KB.


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