Let's say I have three unsigned integers, A
, B
, and C
, and I know the maximum values of each. Both A
and B
are less than 214, and C
is less than 24. Since 14 + 14 + 4 = 32
, I should be able to store these three integers in 32 bits, right?
If so, how can I do this in python? Struct.pack only appears to support byte-sized registers, so I would be limited to 'HHB', which is 40 bits (8 more than I need). Can this be done, or am I missing some fundamental concepts here?