I am trying to define a structure such that its not padded out to the nearest byte.
I did think that the directive #pragma pack(1) meant that across a 32 bit (4 byte) boundry all the bits are used.
e.g.
#pragma pack(1)
typedef __declspec(align(1)) struct{
unsigned long a1_t12_word_0_block_label : 12;
unsigned long a1_t12_word_0_spare_825_12 : 2;
unsigned long a1_t12_word_0_hset_ld_succ : 2;
unsigned long a1_t12_word_1_hqi_a_net : 8;
unsigned long a1_t12_word_1_hqi_b_net : 8;
unsigned long a1_t12_word_2_hqii_na : 8;
unsigned long a1_t12_word_2_hqii_non_na : 8;
unsigned long a1_t12_word_3_hqii_fmt1 : 8;
unsigned long a1_t12_word_3_hqii_fmt2 : 8;
unsigned long a1_t12_word_4_hqii_fmt3 : 8;
unsigned long a1_t12_word_4_hqii_fmt4 : 8;
unsigned long a1_t12_word_5_hqii_fmt5 : 8;
unsigned long a1_t12_word_5_hqii_fmt6 : 8;
unsigned long a1_t12_word_6_sat_na : 8;
unsigned long a1_t12_word_6_sat_non_na : 8;
unsigned long a1_t12_word_7_sat_t40_na : 8;
unsigned long a1_t12_word_7_sat_t40_non_na : 8;
unsigned long a1_t12_word_8_hqii_fmt7 : 8;
unsigned long a1_t12_word_8_hqii_fmt8 : 8;
}a1_VUHF1_T12;
The size of this structure is 20 bytes. It should be 18 bytes, how can I get it to be 18 bytes?
I did think that the directive #pragma pack(1) meant that across a 32 bit (4 byte) boundry all the bits are used.
e.g.
#pragma pack(1)
typedef __declspec(align(1)) struct{
unsigned long a1_t12_word_0_block_label : 12;
unsigned long a1_t12_word_0_spare_825_12 : 2;
unsigned long a1_t12_word_0_hset_ld_succ : 2;
unsigned long a1_t12_word_1_hqi_a_net : 8;
unsigned long a1_t12_word_1_hqi_b_net : 8;
unsigned long a1_t12_word_2_hqii_na : 8;
unsigned long a1_t12_word_2_hqii_non_na : 8;
unsigned long a1_t12_word_3_hqii_fmt1 : 8;
unsigned long a1_t12_word_3_hqii_fmt2 : 8;
unsigned long a1_t12_word_4_hqii_fmt3 : 8;
unsigned long a1_t12_word_4_hqii_fmt4 : 8;
unsigned long a1_t12_word_5_hqii_fmt5 : 8;
unsigned long a1_t12_word_5_hqii_fmt6 : 8;
unsigned long a1_t12_word_6_sat_na : 8;
unsigned long a1_t12_word_6_sat_non_na : 8;
unsigned long a1_t12_word_7_sat_t40_na : 8;
unsigned long a1_t12_word_7_sat_t40_non_na : 8;
unsigned long a1_t12_word_8_hqii_fmt7 : 8;
unsigned long a1_t12_word_8_hqii_fmt8 : 8;
}a1_VUHF1_T12;
The size of this structure is 20 bytes. It should be 18 bytes, how can I get it to be 18 bytes?