I have three integers, one integer contains data of 7 bits, another integer contains data of 4 bits and the third integer contains data of 5 bits.
I want to concatenate all the three integers into one 16-bit integer side by side without changing the value of each of the integers.
Example:
int a = 1; //7 bit data (uint8)
int b = 2; //4 bit data (uint8)
int c = 3; //5bit data (uint8)
where, 0< a <100 , 0< b < 13, 0< c <32 The result should be as follows:
result = 123;
Example 2:
int a = 99; //7 bit data (uint8)
int b = 12; //4 bit data (uint8)
int c = 31; //5bit data (uint8)
result = 991231; //expected
How can this be achieved using bit wise operators?