News for hackers. Stuff that matters.
Re:A Bit Overcomplicated by spc476 on Thursday August 05, 2021 @08:35PM (#28081888)
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).

There are no comments on this comment yet.