| - OR

& - AND

^ - XOR

~ - Unary (opposite)

<< - shift left

>> - shift right

OR is fairly simple:

Code:

(1 | 2)
00000001
| 00000010
-----------------
00000011

It basically just adds the binary of the numbers. It doesn't actually add the numbers though, remember that.

AND is just as easy:

Code:

(1 & 3)
00000001
& 00000011
------------------
00000001

See what it did? everywhere there was a 1 in the first one and the second, there was a 1 in the resulting number.

XOR is trickier:

Code:

(1 ^ 3)
00000001
^ 00000011
------------------
00000010

Anywhere there was a 1 in both numbers, it became a zero.

UNARY is the easiest. It basically means binary opposite:

Code:

(~1)
~0000000001 = 1111111110

<< and >> (shift left and right) are incredibly simple, and used the most:

000000010 >> 1 = 000000001

000000001 << 1 = 000000010

It basicall goes like this: *number* >> *Amount to shift by*

It moves the numbers down by the number you place to the right.

>> Is actually the quickest way to divide by 2

<< Is actually the quickest way to multiply by 2

Another thing about shifts, is that the numbers don't carry! soo:

000000001 >> 1 = 00000000, NOT 10000000

And remember I wrote the numbers out in binary instead of the actual numbers you'd put in there. ( 000000011 is 3, 0000000010 is 2, and 000000001 is 1 binary) So remember, you don't write the numbers in binary, you write them in decimal to use the bit operators.

Any questions, just ask me...