# Bit Shift¶

Bit shift operators move or shift digits to the left or right, and can be used in arithmetic expressions. There are four variants:

• Right Bit Shift, '>>'
• Left Bit Shift, '<<'
• Cyclic Right Bit Shift, 'CRShift'
• Cyclic Left Bit Shift, 'CLShift'

The left argument is the register and the right argument is the number of bits to shift for all variants. The register is available under the name arg. The results are available under the names right_shifted, left_shifted for the first two variants, respectively, by and cyclic_shifted for the last two.

## Right Bit Shift¶

The right bit shift operator shifts bits to the right: the LSBs are discarded and the other bits are 'pushed' to the right.

For a signed register, leftmost bits are filled with the original MSB value.

For an unsigned register, the leftmost bits are filled with '0'.

The radix point location remains fixed.

Unsigned: $$10010111$$ (decimal 151) $$>> 2 = 00100101$$ (decimal 37)

Signed: $$10010111$$ (decimal -105) $$>> 2 = 11100101$$ (decimal -27)

## Left Bit Shift¶

The left bit shift operator shifts bits to the left and adds zeros from the right. The radix point location remains fixed.

$$1.01$$ (decimal 1.25) $$<< 2 = 101.00$$ (decimal 5)

## Cyclic Bit Shift¶

The cyclic bit shift operator moves the bits in a cyclic manner, keeping the string size fixed.

$$CRShift(10100,2) = 00101$$

$$CLShift(10100,2) = 10010$$