Agh! Only a short time away from coding and it seems I've forgotten everything I knew.
I'm trying to seperate a 32 bit integer from a read pixel into seperate rgb. I thought it went something like this.
Which gets me the r,g,b from the integer represting $AARRGGBB
But no, r,g,b just returns $FF everytime, regardless of the contents of rgb. I thought using AND meant it only return the last 8 bits, but apparently not.
I'm at a bit of a loss it seems. Any help, or a refresher on bitwise operations would be greatly appreciated.
I'm trying to seperate a 32 bit integer from a read pixel into seperate rgb. I thought it went something like this.
r=(rgb shr 16) and $FF g=(rgb shr 8) and $FF b=(rgb) and $FF
Which gets me the r,g,b from the integer represting $AARRGGBB
But no, r,g,b just returns $FF everytime, regardless of the contents of rgb. I thought using AND meant it only return the last 8 bits, but apparently not.
I'm at a bit of a loss it seems. Any help, or a refresher on bitwise operations would be greatly appreciated.