Right shift operator

The right shift operator >> produces its result by moving the left operand value's bit to the right. The vacated bits on the left are filled with 0 bits if the left operand value is zero or positive and filled with 1 bits if the left operand value is negative. Bits that are moved to beyond the rightmost bit (the least significant bit) position are discarded.

Example

The following illustrate this using 64-bit binary values.

i := 42;

0000000000000000000000000000000000000000000000000000000000101010

i >> 24

0000000000000000000000000000000000000000000000000000000000000000

i := -42;

1111111111111111111111111111111111111111111111111111111111010110

i >> 24

1111111111111111111111111111111111111111111111111111111111111111