4 ms·
C has the concept of bit fields, and this could be specified as: struct build_info_control { unsigned char : 1; unsigned char SendS
by spc476 5y ago
C has the concept of bit fields, and this could be specified as:
struct build_info_control
{
unsigned char : 1;
unsigned char SendSeq : 3;
unsigned char Poll : 1;
unsigned char RecvSeq : 3;
};
struct build_info_control control;
control.SendSeq = sendSeq;
control.Poll = true;
control.RecvSeq = recvSeq;
The downside of bit fields is that they are implementation specific---you'll have to check the compiler documentation to see if the bits are specified "most significant bit to least significant bit" or "least significant bit to most significant bit" (if that is indeed, important to the problem).