I want to pack the following numbers into a 64 bit int64_t field in the following order:
- int8_t num1
- int8_t num2
- int32_t num3
- int16_t num4
So, the 64 bits should be in the following layout:
[ num1(8) | num2(8) | num3(32) | num4(16) ]
I'm not able to wrap my head around the bit packing logic, i.e. I want those numbers to be packed into a single int64_t field, similar to this question.
Any help is greatly appreciated.