The implementation of bitfields is undefined and depends on which compiler you use.
(EDIT: ignore my incorrect guess about where 36 is from)
I can't think of how you get to 36, but with bitfields I would highly recommend reading them using the normal read access functions, instead of moving them, i.e.
SysData *pSysData = (SysData *) &MsgHdr; headerInfo[0] = pSysData->ContentID;
By the way, I do not understand your example. You say that headerInfo [0] should be 25. But it should not be 0? In your example, it says ContentID is 0, and I realized what you are reading there.
source share