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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -