Technical term for bit packing
By bit packing I mean since int
is of 4 bytes, and if we store 1
inside the int
, remaining bits will be wasted.
short
's value 2
, in the int
variable (by right left shifts)开发者_Python百科.
What is this technique called?
You said it yourself; Bit Packing.
If you are packing individual bits, the result would be a Bitfield. But in this case of two short
s in the space of an integer
, it could also be just byte packing.
But all-in all it is Packing.
精彩评论