struct
{
char unused_bits;
char used_bits;
} abc
short byte2;
I am tring to assign abc to byte2 like this:
byte2 = abc.used_bits;
byte2 << 8;
byte2 = byte2 | abc.unused_bits;
Here we assume used_bits is in the high 8 bits. It is always true no matter
what system and compiler?
a****l 发帖数: 8211
2
of course NOT!
【在 n**d 的大作中提到】 : struct : { : char unused_bits; : char used_bits; : } abc : short byte2; : I am tring to assign abc to byte2 like this: : byte2 = abc.used_bits; : byte2 << 8; : byte2 = byte2 | abc.unused_bits;