Gray code to binary code conversion