Bitwise Operations

Works on bits for left argument, takes an integer as a second argument

Shifts bits of bit_arg n places to the left:

bit_arg<< n

//example
000001<<2 ---> 000100

Shifts bits of bit_arg n places to the right:

bit_arg>>n

//example
000100>>2 ---> 000001

Works on the bits of both arguments

Takes the bitwise AND of left_arg and right_arg:
left_arg & right_arg

1&1 = 1
0&1 = 1&0 = 0&0 = 0

//example
01001000 &
10111000 =
--------
00001000
Takes the bitwise OR of left_arg and right_arg:
left_arg | right_arg

0|0 = 0
1|1 = 1|0 = 0|1 = 1

//example
01001000 |
10111000 =
--------
11111000
Takes the bitwise XOR of left_arg and right_arg:
left_arg ^ right_arg

1^0 = 0^1 = 1
1^1 = 0^0 = 0

//example
01110010 ^
10101010
--------
11011000

Works on the bits of the only argument

Reverses the bits of arg:

~arg

~1 = 0
~1 = 0

//example

~10110010 = 01001101