Bitwise is a designated operator in a programming language that manipulates the individual bits in a byte or word. This is very rarely used in programming, but if you can find out, maybe it can be your shortcut in getting things done
Cheat Sheet
Operators | Description |
& |
AND example: a & b Returns one at each bit position where the corresponding bit of both operands is one. |
| |
OR example: a | b Returns one at each bit position where the corresponding bit of either or both operands is one. |
^ |
XOR example: a ^ b Returns one at each bit position where the corresponding bit of one but not both operands is one. |
~ |
NOT example: ~a Inverts the operand bits. |
<< |
Left Shift a << b Shifts a in binary representation b (<32) bits to the left, shifts zeros from the right. |
>> |
Sign propagating right shift a >> b Shifting a in binary representation b(<32) bits to the right, the discarded bit shifts. |
Example of Use
if the snippet below doesn't work, please open this snippet