New Paste :: Recent Pastes:: No Line Numbers
A Paste by Anonymous
1
/* ... */ #pragma pack(push) #pragma pack(1) struct struct_s { unsigned char b1; unsigned a : 6; unsigned b : 10; }; std::cout << sizeof( struct_s ); #pragma pack(pop) /* ... */
I was expecting the output to be 3 bytes, as in (6 + 10 + 8) / 8 but the answer was 5 , both the 6 bits and the 10 bits was packed to 1 byte. I wonder how to force them together... anyone?