Comment Re:Reminds of of something at a past job (Score 1) 765
hungHi = (word & 0xFFFF0000) >> 16;
FYI, this is pretty bad. It does exactly the same as:
hungHi = word >> 16;
Not necessarily in 64 bit code.
It is not safe if for some reason word is signed (compiler bug on an exotic platform or some programmer resolving some signed/unsigned warning by doing the wrong thing):
((unsigned)0x80000000) >> 16 = 0x00008000
((signed)0x80000000) >> 16 = 0xFFFF8000
Maybe that's what he wants.
Instead, you should use:
hungHi = (word >> 16) & 0xFFFF;
Maybe, or maybe this : hungHi = (word & ~0xFFFF) >> 16;
Don't assume he got it wrong without context, but clearly the choice in variable name don't help understanding...