ReverseBits()

Reverse the bits in a byte.

Syntax


unsigned char ReverseBits(unsigned char b);

b
The byte to reverse.

Returns


unsigned char b with bits reversed.

Example

unsigned char a = ReverseBits(0b11110000);
a ⇒ 0b00001111
unsigned char a = ReverseBits(0b11001100);
a ⇒ 0b00110011
unsigned char a = ReverseBits(0b10110111);
a ⇒ 0b11101101