[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using bitfield syntax



> -----Original Message-----
> From: martinwguy@yahoo.it
> Sent: Sat, 2 Dec 2006 21:49:51 +0000
> To: ejr@inbox.com
> Subject: Re: using bitfield syntax
> 
>> Does anyone know if bit fileds can apply to 16 or 32 for ARM9 without
>> any prolems?
> 
> I'm not quite sure what you're trying to achieve with these
> constructs; extracting single bits from values is usually done with
> explicit logical operations (shifts and masks), not by unioning with
> bitfields... I can't be more specific without knowing what you are
> using these wierd constructs to achieve.

I'm really using them as bit flags instread of defining various boolean variables. So I would have, say 16 status flags that would indicate various application conditions. It's easier to do if(flag.bit1) instead of a logical operation.
make sense?

> 
> However C is certainly happy up to the size of a machine word (int):
> 32 bits in this case.
> I would have thought you could just forget about machine word sizes if
> you're using bitfields in regular programming, but check the C
> Programming Language for the definitive answer; the question is not
> specific to ARM or ARM-version.
> 
>     M



Reply to: