How do I unpack bits from a structure's stream_data in c code?

Posted by Chelp on Stack Overflow See other posts from Stack Overflow or by Chelp
Published on 2010-06-15T08:53:56Z Indexed on 2010/06/15 12:52 UTC
Read the original article Hit count: 147

Filed under:
|

Ex.

typedef struct 
{
  bool streamValid;
  dword dateTime;
  dword timeStamp;
  stream_data[800];
} RadioDataA;

Ex. Where stream_data[800] contains:

**Variable**  **Length (in bits)**
packetID        8
packetL         8
versionMajor    4
versionMinor    4
radioID         8

etc..

I need to write:

void unpackData(radioDataA *streamData, MA_DataA *maData)
{
  //unpack streamData (from above) & put some of the data into maData
  //How do I read in bits of data? I know it's by groups of 8 but I don't understand how.
  //MAData is also a struct.
}

© Stack Overflow or respective owner

Related posts about c

    Related posts about bit-manipulation