IOR Operator

See Also: AND operator, OR operator, IAND operator, Hi function, Low function

Purpose

Performs a bitwise OR on two integral values.

Syntax

( {value1} IOR {value2} )

where {value1} and {value2} may be either expressions, variables or constants of either integral type, Char / UChar / Short / UShort / Integer / UInteger / BigInt / UBigInt.

What It Does

When two values are connected with an encompassing expression by IOR, the encompassing expression evaluates as the value of a binary number derived from the other two values as 1 in positions where either value is 1, and 0 in positions where both values are 0.

Example

move (iMode IOR 1) to iAltMode

In this example, the binary form of the value of iAltMode is set to the value of iMode with its last bit set to 1, regardless of whether the last bit of the binary form of iMode is 1 or 0.

Multiple IORs may be used to link more than two values into a single expression that evaluates as the bitwise or of all the values in the expression:

Example

repeat

    // some code in loop

until (iTop IOR iMiddle IOR iBottom)

In this example, the block of commands controlled by until is executed until no position in the binary form of the values of the variables iTop, iMiddle and iBottom contains 1.

Notes

(1 iand 2 IOR 3 iand 4)

would evaluate as 0, while

(1 IOR 2 iand 3 IOR 4)

would evaluate as 7.