Skip to content

Instantly share code, notes, and snippets.

@retokromer
Created December 11, 2015 20:00
Show Gist options
  • Save retokromer/6a8d8e5bcf4590448a23 to your computer and use it in GitHub Desktop.
Save retokromer/6a8d8e5bcf4590448a23 to your computer and use it in GitHub Desktop.
Gray to Binary for 64-bit Processors
unsigned int Gray_To_Bin(unsigned int g) {
num = g ^ (g >> 32);
num = g ^ (g >> 16);
num = g ^ (g >> 8);
num = g ^ (g >> 4);
num = g ^ (g >> 2);
num = g ^ (g >> 1);
return g;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment