本帖转自http://blog.csdn.net/todototry/archive/2007/04/23/1575900.aspx
但是更加详细的说明如下:
这两个函数极很是巧妙,作了并行计算。
问题1: 将某数的二进制中各位翻转
unsigned char reverse8( unsigned char c )
{
c = ( c & 0x55 ) << 1 | ( c & 0xAA ) >> 1;
c = ( c & 0x33 ) << 2 | ( c & 0xCC ) >> 2;
c = ( c & 0x0F ) << 4 | ( c & 0xF0 ) >> 4;
return c;
}
unsigned int Bit_Reverse(unsigned int v)
{
v = ((v >> 1) & 0x55555555) | ((v << 1) & 0xaaaaaaaa);
v = ((