Bitwise operators
This page describes the available operators to assist with performing bitwise operations on numeric values.
Precedence of these operators is as follows:
~
NOT&
AND^
XOR|
OR
#
~ NOT~
is a unary operation that performs logical negation on each bit. Bits that
are 0 become 1, and those that are 1 become 0. Expects a value of long
or int
type.
Examples:
column |
---|
-1025 |
#
& AND&
is a binary operation that takes two equal-length binary representations and
performs the logical AND operation on each pair of the corresponding bits.
Expects values of long
or int
type.
Examples:
column |
---|
1 |
#
^ XOR^
is a binary operation that takes two bit patterns of equal length and
performs the logical exclusive OR (XOR) operation on each pair of corresponding bits.
Expects a value of long
or int
type.
Examples:
column |
---|
6 |
#
| OR|
is a binary operation that takes two bit patterns of equal length and
performs the logical inclusive OR operation on each pair of corresponding bits.
Expects a value of long
or int
type.
Examples:
column |
---|
7 |