binary - Is it possible in python to pack a set of integers in non-byte increments? -
binary - Is it possible in python to pack a set of integers in non-byte increments? -
let's have 3 unsigned integers, a, b, , c, , know maximum values of each. both a , b less 214, , c less 24. since 14 + 14 + 4 = 32, should able store these 3 integers in 32 bits, right?
if so, how can in python? struct.pack appears back upwards byte-sized registers, limited 'hhb', 40 bits (8 more need). can done, or missing fundamental concepts here?
pack bit operators:
(a<<18)|(b<<4)|c then utilize struct.pack on 32-bit result.
python binary
Comments
Post a Comment