I l@ve RuBoard Previous Section Next Section

11.3 Bitwise OR (|)

The inclusive OR operator (also known as just the OR operator) compares its two operands. If one or the other bit is a 1, the result is 1. Table 11-4 lists the truth table for the OR operator.

Table 11-4. Bitwise OR operator

Bit1

Bit2

Bit1 | Bit2

0

0

0

0

1

1

1

0

1

1

1

1

Here's an example of bitwise OR performed on a byte:

       i1=0x47       01000111
|      i2=0x53       01010011
______________________________
         0x57        01010111
    I l@ve RuBoard Previous Section Next Section