gray code, right shift and XOR with itself