所以它只是很多位移。的比特是按照以下顺序:
现在,第一行中,第一部分保持高比特,设定较低位为0(掩模是0b11110000),转移他们4到右侧。第二部分确实对于较低的位(掩模是0b00001111),并转移到左侧的相同:
first line, first part: 7654xxxx => xxxx7654 (bits shift to the right)
first line, second part: xxxx3210 =>xxxx (bits shift to the left)
add them together: =>7654
然后,第二行。相同的动作,不同的掩模(0b11001100和0b00110011,分别地),与32107654
:
second line, first part: 32xx76xx => xx32xx76 (bits shift to the right)
second line, second part: xx10xx54 => 10xx54xx (bits shift to the left)
add them together: => 10325476
第三行是具有再次其他掩模(表示为0b10101010和0b01010101,分别地)是相同的,与10325476
:
third line, first part: 1x3x5x7x => x1x3x5x7 (bits shift to the right)
third line, second part: x0x2x4x6 => 0x2x4x6x (bits shift to the left)
add them together: =>
因此,我们最终,最后,用行动:在b
=>
转换常数为二进制看什么他们的意思。 – Barmar
这会互换4位组,然后是2,然后是1.首先,7654与3210.然后,7632与5410.然后,7531与6420.只是写这让我意识到,要解释它并不容易指点:P – AntonH
逐句通过调试器中的函数,在每个语句后以二进制格式打印'b'。你将会开悟。 – Barmar