|
V+ 12.4 Release Notes |
... value BOR value ...
Perform the binary OR operation on two values.
The BOR operation is meaningful only when performed on integer values.
The BOR operator can be used to perform a binary OR operation on two values on a bit-by-bit basis, resulting in a real value. Note, however, that this operation is meaningful only when performed on integer values.
Specifically, the BOR operation consists of the following steps:
1. Convert the operands to sign-extended 32-bit integers, truncating any fractional part.
2. Perform a binary OR operation (see below).
3. Convert the result back to a real value.
During the binary OR operation,
c = a BOR bthe bits in the resultant C statement are determined by comparing the corresponding bits in the operands A and B as indicated in Combining A and B Operands Using the BOR Operator.
Table 2-2. Combining A and B Operands Using the BOR Operator For each bit in: a b c 0 0 -> 0 0 1 -> 1 1 0 -> 1 1 1 -> 1That is, a bit in the result will be 1 if the corresponding bit in either of the operands is 1.
Refer to the V+ Language User's Guide for the order in which operators are evaluated within expressions.
Consider the following (binary values are shown only to make the operation more evident):
^B101000 BOR ^B100001 yields ^B101001 (41)
Note that a very different result is obtained with the logical OR operation:
^B101000 OR ^B100001 yields -1 (TRUE)
In this case, ^B101000 and ^B100001 are each interpreted as logically TRUE since they are nonzero.
... value BAND value ... (operator)
... value BXOR value ... (operator)
Perform the binary exclusive-OR operation on two values.
The BXOR operation is meaningful only when performed on integer values.
The BXOR operator can be used to perform a binary exclusive-OR operation on two values on a bit-by-bit basis, resulting in a real value. Note, however, that this operation is meaningful only when performed on integer values.
Specifically, the BXOR operation consists of the following steps:
1. Convert the operands to sign-extended 24-bit integers, truncating any fractional part.
2. Perform a binary exclusive-OR operation (see below).
3. Convert the result back to a real value.
During the binary exclusive-OR operation,
c = a BXOR bthe bits in the resultant C are determined by comparing the corresponding bits in the operands A and B as indicated in Combining A and B Operands Using the BXOR Operator.
Table 2-3. Combining A and B Operands Using the BXOR Operator For each bit in: a b c 0 0 -> 0 0 1 -> 1 1 0 -> 1 1 1 -> 0That is, a bit in the result will be 1 if the corresponding bit in one (and only one) of the operands is 1.
Refer to the V+ Language User's Guide for the order in which operators are evaluated within expressions.
Consider the following (binary values are shown only to make the operation more evident):
^B101000 BXOR ^B100001 yields ^B001001 (9)
Note that a very different result is obtained with the logical XOR operation:
^B101000 XOR ^B100001 yields 0 (FALSE)
In this case, ^B101000 and ^B100001 are each interpreted as logically TRUE since they are nonzero.
... value BAND value ... (operator)
... value BOR value ... (operator)
|
Please submit comments to: techpubs@adept.com |