AnsweredAssumed Answered

Padding and alignment in CodeWarrior for MC1321x (HCS08)

Question asked by Andrey Polonsky on Aug 24, 2009
Latest reply on Aug 25, 2009 by Andrey Polonsky

When creating an array of a bit field structure as in the example below, is it possible to fit two 4-bit array members into a single byte?


typedef struct {
  unsigned int my_location : 2;

  unsigned int my_WATCHDOG : 2;

} foo;


foo my_array[1000] = 0;


Is it possible to have the above result in 500 bytes of 1000 elements, each addressed by my_array[i] or will CW pad every element such that 1000 bytes will be used by the array?


Thanks for the help,