Created
July 15, 2012 20:59
-
-
Save Bigcheese/3118606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned char BitReverse(unsigned char val, unsigned char bits) { | |
unsigned char result = 0; | |
unsigned char i; | |
for (i = 0; i < bits; ++i) { | |
result += ((val >> (bits - i - 1)) & 1) << i; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment