- 5
- 0
- 约1.55万字
- 约 26页
- 2017-06-05 发布于河南
- 举报
C语言的逻辑判断(国外英文资料)
C语言的逻辑判断
Cs logical judgment
The bit operator in the C language
Because C is designed to replace assembly language, it is
You must support the computing power of the assembly language, so C
Hold all the bit operators
(Bitwise Operators). Bit operations are in bytes or words
Bit (bit) is tested, bit, or shifted processing, in the microprocessing
In the programming of the device, especially
The register, I/O port is operated. So this is going to be true
This is described in more detail.
The form and meaning of the six bit operators are as follows:
AND (AND);
| : press OR (OR);
^ : according to the exclusive or (XOR);
~ : take the reverse (NOT);
: the data is moved to the right;
: data left;
1) press the and operation
The role of the and operator is to both sides of the operator
The operands of binary expressions are and by bits, and this is
The first operation is the same in number
The bit is in the unit. The rule of action is: only two
When the number of operations is 1, the output will be 1, otherwise 0.
Such as:
A = 0x88, b = 0x81, and the operation of a b is as follows:
0x88, 1000, 1000 a
0x81, 1000, 0001, b
Is equal to 1000, 000
Among them, the operator gives a number 0x88 and B number 0x81 1 and 1,
Two and two... 7 bits are with 7. Because of the with operation
The operating rules are
So, for each of the two operands, you only have one of them, and then you have the corresponding one
Bit is 0. And the only digit in a and b is 1,
The result is 1
All the other guys are going to be 0.
Normally we can close a person by the and operation
So, for example, if we want to close the third digit in a,
It doesnt affect anything else
The status quo of bits can be used with a number 0xF7, or binary number 1111, 0111
To do the and operations with a number:
0x88, 1000, 1000 a
0xF7 1111 0111 block number
Is equal to 1000, 000
Notice that the other guys are equal to 1, except for the third digit, which is 1
The result will only be 0 in the third position of a, and the other
原创力文档

文档评论(0)