Bitwise operators
Bitwise operators let you examine and manipulate individual bits within a value. These operators must only be applied to integers, not floating point numbers.
TIP:
The bitwise operators &, |, and ^ compare two integers or tags on a bit by bit basis.
The bitwise operators >>, <<, and ~ operators manipulate a single integer or tag.
The following table lists the bitwise operators.
Symbol | Operator | Example |
---|---|---|
& | AND | tag_1 & 07 |
| | inclusive OR | tag_2 | tag_1 |
^ | exclusive OR (XOR) | tag_1 ^ 01 |
>> | right shift | tag_1 >> 1 |
<< | left shift | tag_1 << 2 |
~ | complement | ~ tag_1 |
Provide Feedback