I am using C++ in windows OS.

I have 2 values.value1 and value 2.

I want to write value 1 in first 2 bits, and value 2 in last 6 bits of a unsigned char.

and similarly I want to extract value1 and value2 from unsigned char using bit manipulation.

Please help me how to achieve my requirement.