OR Functions
The OR functions create a result by combining each bit of one number with the corresponding bit of the other number. If a pair of corresponding bits are both 0, the result for that bit position is 0; otherwise the result is 1, as shown in the table.
|
OR |
arg1 |
||
|
0 |
1 |
||
|
arg2 |
0 |
0 |
1 |
|
1 |
1 |
1 |
|
Sample Syntax
INT1OR(arg1, arg2)
Remarks
| • | The OR functions are commutative; that is, the order of the arguments does not affect the outcome. |
Examples
|
Function Input |
Result |
Comments |
|
INT1OR(0,x) |
x |
0 ORed with any number returns the same number, regardless of sign. |
|
INT1OR(-0,x) |
x |
-0 is mapped to 0 before being ORed with the other argument. |
|
INT1OR(64,-64) |
-64 |
|
|
INT1OR(64,-66) |
-2 |
|
|
INT1OR(66,-64) |
-62 |
|
|
INT1OR(-66,-64) |
-2 |
|
|
INT1OR(-1,x) |
-1 |
-1 ORed with any positive number results in -1. |
|
INT1OR(-128,1) |
-127 |
|
|
. . . |
|
|
|
INT1OR(-128,127) |
-1 |
|
|
INT1OR(-128,-x) |
-x |
-128 ORed with any negative number results in the same negative number. |