Bitwise Operator Support
Standard
PowerBuilder applications allow the use of the logical operators AND,
OR, and NOT to evaluate boolean expressions. In .NET applications
and components, in addition to evaluating boolean expressions, you
can use these same operators to perform bitwise evaluations.
For
the AND and OR operators, a bitwise evaluation compares the bits
of one operand with the bits of a second operand. For the NOT operator,
a bitwise evaluation assigns the complementary bit of the single
operand to a result bit.
The operands in a bitwise comparison must have integral data
types, such as integer, uint, long, ulong,
and longlong. However, if either of the operands
(or the sole operand in the case of a NOT operation) has an any datatype,
the .NET application or component treats the operation as a standard
logical evaluation rather than as a bitwise comparison.
You can perform a bitwise comparison only inside a .NET conditional compilation
block. If you try to evaluate operands with integral datatypes in
a standard PowerBuilder application, you will get a compiler error.
For .NET applications and components, you can also use the
bitwise operator XOR. If you use this operator to evaluate a boolean
expression in the .NET environment, the return result is true only
when one of the operands is true and the other is false. If both
operands are true, or both are false, the return result for the
XOR operator is false.
This table describes
the result of using the bitwise operators:
Operator |
Description |
---|---|
AND |
The bitwise �AND� operator |
OR |
The bitwise �inclusive OR� operator |
XOR |
The bitwise �exclusive OR� operator |
NOT |
This is a unary operator. It produces |