This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Bitfield packing
- From: eddy at fericom dot net
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 17 Aug 2002 09:33:37 +0200
- Subject: Bitfield packing
Hi,
I am using gcc for a microcontroller application. I want to use
bitfields to describe the processor registers,
similar to this:
typedef union {
IO_BYTE byte;
struct {
IO_BYTE P30 :1;
IO_BYTE P31 :1;
IO_BYTE P32 :1;
IO_BYTE P33 :1;
IO_BYTE P34 :1;
IO_BYTE P35 :1;
IO_BYTE P36 :1;
IO_BYTE P37 :1;
} bit;
} PDR2;
How does gcc handle bitfields like thisone? Above I have defined 8 bits,
are they distributed on several bytes with some optimization levels?
How do I setup gcc, so that it will always assign the bits 1:1 (no
packing/optimization)?
Thanks
Eddy Ilg