The code below gives me a Narrowing conversion from int to uint32_t:
typedef union RGB
{
uint32_t Color;
struct
{
unsigned char B, G, R, A;
};
} *PRGB;
inline RGB Rgb(int R, int G, int B) {RGB Result = {((R & 255) << 16) | ((G & 255) << 8) | (B & 255)}; return Result;}
Error:
warning: narrowing conversion of '((((R & 255) << 16) | ((G << 8) & 65535)) | (B & 255))' from 'int' to 'uint32_t {aka unsigned int}' inside { } [-Wnarrowing]
What I do not understand is why it tells me ((G << 8) & 65535))
.. Where in the world does the 65535 come from :S