Bitwise Operators in ActionScript - Part 2

Notes:

Bitwise Operators in ActionScript Programming Language - Part 2:

Bitwise Operators:
- are used to perform operations on bits.

- Bitwise operators convert the given decimal number(s) to their binary equivalent number,
and then they perform the operations on bits of those binary equivalent number(s).

~: Bitwise complement operator:
It is the unary operator, used to switch bits of the given operand.
It adds 1 to the given operand and changes the sign.

<<: Bitwise Left Shift operator:
Shifts the bits of LHS number to the left by number of positions indicated by RHS number
LHSNumber * pow(2,RHSNumber)

>>: Bitwise Right Shift operator:
Shifts the bits of LHS number to the right by number of positions indicates by RHS number
LHSNumber / pow(2,RHSNumber)

Example code:
trace(~2); //-3
trace(~5); //-6
trace(~-3); //2
trace(~-9); //8

trace(1<<4); //16
trace(5<<1); //10

trace(16>>4); //1
trace(20>>1); //10