Loading docs/math/bit.md +23 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,15 @@ > 举例: > > $\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 +40,13 @@ > 举例: > > $\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 +62,13 @@ > > 举例: > > $\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 +23 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,15 @@ > 举例: > > $\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 +40,13 @@ > 举例: > > $\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 +62,13 @@ > > 举例: > > $\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