Computer Languages
Shift Mnemonic


The SHIFT instruction provides a logical shift of one or more places to the right, or to the left, of a string of binary digits.

In the SHR instruction the least significant bit (the furthest to the right) is moved into a separate place as a carry bit. The empty space on the extreme left is filled by a 0. The syntax differs depending on the particular micro-processor the program is going to run under.

MOV AX,10110111B Puts the binary value 10110111 into AX
SHR AX,1 1 logical right shift is performed on the number

In the example code above, the result would be that AX would store the binary value 01011011.
Note that the B after the number confirms that it is a binary number.

This procedure could be used to examine the least significant bit of the number. Similarly SHL could be used to find the most significant bit.