Tara Pandey

Problem with structure bit fields

Discussion created by Tara Pandey on Nov 18, 2008
Latest reply on Nov 18, 2008 by Rich Testardi
The down piece of code builds under wind river diab compiler, the same does not happen in Code Warrior as it does not support the "maxalign" pragma. Please find the attachment which details the maxalign pragma functionality for reference.
I am pointing this structure to a series of registers and checking for the bits through these bit fields registers (mystruct).
With Diab build everything works fine and when I port the same code in Code Warrior, It does not build. When I remove the maxalign pragma to make it build the code does not work as required.
Is there any exact/proper replacement for the #pragma maxalign in Code Warrior?
or Can you please send me a sample code which uses bit fields to access bits in a register.
#pragma pack(1)
#pragma maxalign(1)
 typedef struct
   ungined char aa   : 1;
   ungined char bb   : 1;
   ungined char cc   : 6;
   ungined char dd   : 8;
   ungined char ee   : 1;
   ungined char ff    : 2;
   ungined char gg  : 1;
   ungined char hh  : 4;
 } mystruct;
#pragma maxalign()
#pragma pack()
Best regards