Use XOR / AND / OR operation with the last bit.