Odd or Even Checking

Modulo is unnecessary for checking whether a number is odd or even when using bitwise operations. ANDing a number with 1 isolates its least significant bit. A result of 1 from ANDing a number with 1 means the number is odd. A result of 0 f…

1 sources - 4 claims

Modulo is unnecessary for checking whether a number is odd or even when using bitwise operations. ANDing a number with 1 isolates its least significant bit. A result of 1 from ANDing a number with 1 means the number is odd. A result of 0 from ANDing a number with 1 means the number is even.