作者executor1107 (计概让人起笑...)
看板NSYSU-CSE97
标题[分享] [计概] [Chapter 4.2] 随手整理
时间Sat Dec 18 02:16:30 2004
4.2.1 Truth Table(必记)
4.2.2
Unary Operator-NOT
Function:Change 1 to 0,0 to 1.
Binary Operator-AND
Function:Only the comparison both has 1.The result can be 1(positive).
1 1 -> 1
0 1 -> 0
1 0 -> 0
0 0 -> 0
Binary Operator-OR
Function:Once there is 1 in the comparison.The result is 1(positive).
1 1 -> 1
0 1 -> 1
1 0 -> 1
0 0 -> 0
Binary Operator-XOR
Function:If the pattern 1 and 2 which in the comparison are the same,the
result would be 0.Otherwise,the patterns are different would make
the result been 1.
(Warning:The XOR is not present the
directly against with AND.)
1 1 -> 0
0 1 -> 1
1 0 -> 1
0 0 -> 0
4.2.3 Mask
Unsetting specific Bits:
One of the applications of the AND operator is to unset (Force to 0)
specific bits in a bit pattern. The rule for constructing an unsetting
mask can be summarized as follows:
1. To unset a bit in the target bit pattern, use 0 for the corresponding
bit in the mask.
2. To leave a bit in the target bit pattern unchanged, use 1 for the
corresponding bit in the mask.
Any question about the following up.Please refer to 4.2.2 operator AND.
Setting Specific Bits:
One of the application of the OR operator is to set (Force to 1) specific
bits in a bit pattern. To do so, use a setting mask with the same bit
length. The rules of constructing a setting mask can be summarized as follows:
1. To set a bit in the target bit pattern, use 1 for the corresponding bit
in the mask.
2. To leave a bit in the target bit pattern, use 0 for the corresponding bit
in the mask.
Any question about the following up.Please refer to 4.2.2 operator OR.
Flipping Specific Bits:<Most confused application...>
One of the application of XOR is to flip bits,which means to change the value
of specific bits from 0s to 1s,and vice versa.The rules for constructing
an XOR mask can be summarized as follows:
1. To flip a bit in the target bit pattern,use 1 for the corresponding
bit in the mask.
2. To leave a bit in the target bit pattern unchanged,use 0 for the
corresponding bit in the mask.
Any question about the following up.Please refer to 4.2.2 operator XOR.
--
......ID......
......I am a learning Dancer......
Shake my body through the music...
Dance with the Feel...
This is my ID......
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.117.186.180
1F:推 Isuzel:澎澎大神~~~(膜拜) 140.117.186.150 12/18