I'm looking at the original source code for Identicons. There's a bit of code that does some bit twiddling to extract red, green and blue components:
int blue = (code >> 16) & 0x01f;
int green = (code >> 21) & 0x01f;
int red = (code >> 27) & 0x01f;
The code variable is a 32 bit integer.
My question is this: What's the difference between the number 0x01 and 0x01f?
I'm assuming the f means the value is a float, but why make it a float? Is it that the float representation in binary is different to the integer representation? Wouldn't that cause issues for portability reasons when porting if a particular language doesn't use the same representation?
Also, I'm probably reading this wrong on account of not understanding the 0x01f issue, but isn't this just setting the red, green and blue representations to either 0 or 1, depending on the least significant bit?