Bitrvis Operatorer
Bitwise AND
a & b
Returns a one in each bit position for which the corresponding bits of both operands are ones.
Bitwise OR
a | b
Returns a one in each bit position for which the corresponding bits of either or both operands are ones.
Bitwise XOR
a ^ b
Returns a one in each bit position for which the corresponding bits of either but not both operands are ones.
Bitwise NOT
~ a
Inverts the bits of its operand.
Left shift
a << b
Shifts a in binary representation b bits to left, shifting in zeros from the right.
a
b
Sign-propagating right shift
a >> b
Shifts a in binary representation b bits to right, discarding bits shifted off.
Zero-fill right shift
a >>> b
Shifts a in binary representation b bits to the right, discarding bits shifted off, and shifting in zeros from the left.