Re: Atrribute packed and aligned causes alignment trap on ERC32 (SPARC v7)

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

 



Hi Ulf,

In your situation, don't use a C bitfield.

Use a C char for your struct data member, where the lsb (or msb) is your bit of interest, and the other 7 bits are fallow.

On most platforms, a C char is an octet (8 bits).  It has the packing you want, without using GCC-isms to contort a natural machine word (i.e., an int) into unaligned access (as you are doing with your bitfield struct).

Some architectures do not work with unaliagned word access.

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux