I have two main questions:
1. What does the '&' actually do to the number in binary? How do I convert the number back?
For example, if I put in:Code:#define RGB16BIT565(r,g,b) ((b & 31) + ((g & 63) << 5) + ((r & 31)<<11))
what does the 255 change to?Code:color = RGB16BIT565(255, 0, 0);
2. Is this the proper way to get the original value back?
Would this code successfully return the number 255?Code:#define RGB32BIT(a,r,g,b) ((b) + ((g) << 8) + ((r) << 16) + ((a) << 24) color = RGB32BIT(0, 255, 0, 0); red = (color >> 16) & 255;
Please don't numb down your answers. I'm not stupid. I have just never been taught.