This is the mail archive of the gcc-help@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]

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


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