I have packed data of rgba values in an 16 bit short, so for each channel goes 4bit, how can I change specific channel only, lets say I want to change red channel to it's value devided by two. I know how to change specific bits in an int but changing bit by bit would be very slow and tiresome.
So in code First I save RGBA values in a short:
RGBA = R | (G << 4) | (B << 8) | (A << 12)
Then I want to change 'A' part of the RGBA short to A / 2.