Question on bitmasks. With what operation can I combine two bit variables into one? The reverse operation is done through zeroing and bit shifting, but I can’t think of it (

a = 0101 b = 1010 с = a ? b = 0101 1010

    1 answer 1

     с = (a << 4)|b 

    or

     с = (a << 4) + b 

    or

     с = a * 16 + b