| << D.2.5- Logical operators | AppendixD | D.2.7- Operator Precedence >> |
Bitwise operators
Bitwise operators are used forcomparing binary values bit-by-bit; they are listed in order of Operator Precedence.All bitwise operators can also be used as logical operators (see under Logical Operators).
| Not | Used to
Returns
Syntax
| Invert the bit values.
Returns 1 if bit is 0 and vice versa.
Result = Not expression
If expression is 101 then result is 010. |
| And | Used to
Returns
Syntax
| Check if both bits are set to 1.
Returns 1 if both bits are 1; otherwise, 0 is returned.
Result = expression1 And expression2
If expression1 is 101 and expression2 is 100 then result is 100. |
| Or | Used to
Returns
Syntax
| Check if one of the bits is set to 1.
Returns 1 if one or both bits are 1; otherwise, 0 is returned.
Result = expression1 Or expression2
If expression1 is 101 and expression2 is 100 then result is 101. |
| Xor | Used to
Returns
Syntax
| Checks if one and only one of the bits are set to 1.
Returns 1 if only one bit is 1; otherwise, 0 is returned.
Result = expression1 Xor expression2
If expression1 is 101 and expression2 is 100 then result is 001. |
| Eqv | Used to
Returns
Syntax
| Checks if both bits evaluate to the same value.
Returns 1 if both bits have the same value (0 or 1).
Result = expression1 Eqv expression2
If expression1 is 101 and expression2 is 100 then result is 110. |
| Imp | Used to
Returns
Syntax
| Performs a logical implication on two bits.
Returns these values:
0 Imp 0 = 1 0 Imp 1 = 1 1 Imp 1 = 1 1 Imp 0 = 0
Result = expression1 Imp expression2
If expression1 is 101 and expression2 is 100 then result is 110. |
| << D.2.5- Logical operators | AppendixD | D.2.7- Operator Precedence >> |

RSS
