This file contains hidden or 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 reverse_bit8(unsigned char x) | |
{ | |
x = ((x & 0x55) << 1) | ((x & 0xAA) >> 1); | |
x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2); | |
return (x << 4) | (x >> 4); | |
} | |
unsigned short reverse_bit16(unsigned short x) | |
{ |