In the future, rather than modulo by 2 you should binary and by 1 (afterall a number cannot be odd if the 1 bit is not set). Maybe a good compiler would catch and optimize that anyway, but it's always good to be certain.
But surely, in this case, a sub is even better.
|