Loading docs/math/bit.md +119 −119 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ <td style="text-align:center;"><code>^</code></td><td>只有两个(对应位数)不同时才为 1。</td> </tr></table> * `^` 运算的逆运算是它本身,也就是说两次异或同一个数最后结果不变,即 `(a ^ b) ^ b = a`。 - `^` 运算的逆运算是它本身,也就是说两次异或同一个数最后结果不变,即 `(a ^ b) ^ b = a`。 > 举例: > > $$ \begin{aligned} &5&=&&(101)_2\ &6&=&&(110)_2\ &5\tt,&,6\rm&=&&(100)_2&=\ 4\ &5\tt,|,\rm6&=&&(111)_2&=\ 7\ &5\tt,\text{^},\rm6&=&&(011)_2&=\ 3\ \end{aligned} $$ > $\begin{aligned} &5&=&&(101)_2\ &6&=&&(110)_2\ &5\tt,&,6\rm&=&&(100)_2&=\ 4\ &5\tt,|,\rm6&=&&(111)_2&=\ 7\ &5\tt,\text{^},\rm6&=&&(011)_2&=\ 3\ \end{aligned}$ #### 取反 Loading @@ -32,7 +32,7 @@ > 举例: > > $$ \begin{aligned} 5=(0000\ 0101)_2\ 5\ \text{的补码} =(1111\ 1010)_2\ \tt\ \text{~}\rm5=(1111\ 1010)_2 \end{aligned} $$ > $\begin{aligned} 5=(0000\ 0101)_2\ 5\ \text{的补码} =(1111\ 1010)_2\ \tt\ \text{~}\rm5=(1111\ 1010)_2 \end{aligned}$ ## 左移和右移 Loading @@ -48,7 +48,7 @@ > > 举例: > > $$ \begin{aligned} &5&&=&&(101)_2\ &5\tt,<<,\rm2&&=&&(10100)_2!!!&=&&!!!20\ &5\tt>>\rm1&&=&&(10)_2&=&&2 \end{aligned} $$ > $\begin{aligned} &5&&=&&(101)_2\ &5\tt,<<,\rm2&&=&&(10100)_2!!!&=&&!!!20\ &5\tt>>\rm1&&=&&(10)_2&=&&2 \end{aligned}$ 如上图,右移操作中末尾多余的 “1” 将会被舍弃。 Loading Loading
docs/math/bit.md +119 −119 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ <td style="text-align:center;"><code>^</code></td><td>只有两个(对应位数)不同时才为 1。</td> </tr></table> * `^` 运算的逆运算是它本身,也就是说两次异或同一个数最后结果不变,即 `(a ^ b) ^ b = a`。 - `^` 运算的逆运算是它本身,也就是说两次异或同一个数最后结果不变,即 `(a ^ b) ^ b = a`。 > 举例: > > $$ \begin{aligned} &5&=&&(101)_2\ &6&=&&(110)_2\ &5\tt,&,6\rm&=&&(100)_2&=\ 4\ &5\tt,|,\rm6&=&&(111)_2&=\ 7\ &5\tt,\text{^},\rm6&=&&(011)_2&=\ 3\ \end{aligned} $$ > $\begin{aligned} &5&=&&(101)_2\ &6&=&&(110)_2\ &5\tt,&,6\rm&=&&(100)_2&=\ 4\ &5\tt,|,\rm6&=&&(111)_2&=\ 7\ &5\tt,\text{^},\rm6&=&&(011)_2&=\ 3\ \end{aligned}$ #### 取反 Loading @@ -32,7 +32,7 @@ > 举例: > > $$ \begin{aligned} 5=(0000\ 0101)_2\ 5\ \text{的补码} =(1111\ 1010)_2\ \tt\ \text{~}\rm5=(1111\ 1010)_2 \end{aligned} $$ > $\begin{aligned} 5=(0000\ 0101)_2\ 5\ \text{的补码} =(1111\ 1010)_2\ \tt\ \text{~}\rm5=(1111\ 1010)_2 \end{aligned}$ ## 左移和右移 Loading @@ -48,7 +48,7 @@ > > 举例: > > $$ \begin{aligned} &5&&=&&(101)_2\ &5\tt,<<,\rm2&&=&&(10100)_2!!!&=&&!!!20\ &5\tt>>\rm1&&=&&(10)_2&=&&2 \end{aligned} $$ > $\begin{aligned} &5&&=&&(101)_2\ &5\tt,<<,\rm2&&=&&(10100)_2!!!&=&&!!!20\ &5\tt>>\rm1&&=&&(10)_2&=&&2 \end{aligned}$ 如上图,右移操作中末尾多余的 “1” 将会被舍弃。 Loading