HP C A.06.05 Reference Manual
Expressions and Operators
Bit Operators (<<, >>, &, ^, |, ~)
Chapter 5 95
The following table shows an example of the bitwise AND operator:
Bitwise Inclusive (|) OR The bitwise inclusive OR operator performs logical operations on
a bit-by-bit level using the following truth table:
The bitwise inclusive OR operator (|) places a 1 in the resulting value's bit position if either
operand has a bit set at the position.
111
Table 5-2 The Bitwise AND Operator
Expression Hexadecimal Value Binary Representation
9430
5722
0x24D6
0x165A
00100100 11010110
00010110 01011010
9430 & 5722 0x0452 00000100 01010010
Table 5-3 Truth Table
bit x of op1 bit x of op2 bit x of result
000
011
101
111
Table 5-4 Example Using the Bitwise Inclusive OR Operator
Expression Hexadecimal Value Binary Representation
9430
5722
0x24D6
0x165A
00100100 11010110
00010110 01011010
9430 | 5722 0x36DE 00110110 11011110
Table 5-1 Truth Table for the bitwise AND operator, (&) (Continued)
bit x of op1 bit x of op2 bit x of result