Quote:
Originally Posted by Dark Visor
Could someone please explain how does this function work?
|
Well ... all Powers of 2 except 2^0 are even.
So if a number is odd, it must have Bit 0 (2^0=1) set, so this functions checks for this Bit being set.
Quote:
But 2 in second power multiplied by 1 is 5, not 1... (wtf?)
|
1*2^0 = 1*1 = 1
0*2^1 = 0*2 = 0
1*2^2 = 1*4 = 4
In Total: 5