Information Storage
Information Storage(信息存储)
Boolean Algebra
$\sim$ => NOT(非)
$$ \begin{array}{c|lcr} \sim & \text{} & \text{example} \\ \hline 0 & 1 & \sim0=1 \\ 1 & 0 & \sim1=0 \end{array} $$
$&$ => AND(与)
$$ \begin{array}{c|lcr} & & 0 & 1 \\ \hline 0 & 0 & 0 \\ 1 & 0 & 1 \end{array} $$
example
-
0 & 0 = 0
-
0 & 1 = 0
-
1 & 0 = 0
-
1 & 1 = 1
$|$ => OR(或)
$$ \begin{array}{c|lcr} | & 0 & 1 \\ \hline 0 & 0 & 1 \\ 1 & 1 & 1 \end{array} $$
example
- 0 | 0 = 0
- 0 | 1 = 1
- 1 | 0 = 1
- 1 | 1 = 1
^ => EXCLUSIVE-OR(异或)
$$ \begin{array}{c|lcr} ^{} & 0 & 1 \\ \hline 0 & 0 & 1 \\ 1 & 1 & 0 \end{array} $$
example
-
0 ^ 0 = 0
-
0 ^ 1 = 1
-
1 ^ 0 = 1
-
1 ^ 1 = 0
Shift Operation in C
Operation(操作) | Value1 | Value2 |
---|---|---|
x | $[0110\ 0011]$ | $[1001\ 0101]$ |
x « 4 | $[0011\ 0000]$ | $[0101\ 0000]$ |
x » 4(logical) | $[0000\ 0110]$ | $[0000\ 1001]$ |
x » 4(arithmetic) | $[0000\ 0110]$ | $[1111\ 1001]$ |
资料由
九曲阑干
视频提供,如有侵权,联系sliver_horn@qq.com
删!