Hi,
Gosh, I haven't seen that one for years. I think it needs a barrel
shifter to work well, though. I'm pretty sure direct shift out and shift
in will do better on the MSP430.
Regards,
Steve
Regards,
Steve
Leon Heller wrote:
Here's a clever way to do it that I found via Google:
//
// Reverse the order of bits within a byte.
// Returns: The reversed byte value.
//
BYTE ReverseBits(BYTE b)
{
BYTE c;
c = ((b >> 1) & 0x55) | ((b << 1) & 0xaa);
c |= ((b >> 2) & 0x33) | ((b << 2) & 0xcc);
c |= ((b >> 4) & 0x0f) | ((b << 4) & 0xf0);
return(c);
}
I haven't checked it, though.