I want to combine three characters into a short using bit shifting. This is for implementing the RGB565 color palette (where there are 5 bits for red, 6 for green, 5 for blu
We shift r left by 11 bits, g left by 5 bits and bitwise OR these with b shifted right by 3 bits. (NB: this assumes the values have already been correctly masked, if needed, to remove any unwanted bits.)