Jump to content

Logical shift

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 202.189.104.87 (talk) at 05:05, 16 May 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

There are Logical Left Shift and Logical Right Shift in machine language which operations are similar to arithmetic shift

Logical Left Shift moves the bit pattern to the left while Logical Right Shift moves the bit pattern to the right.

Example: R1=1111 0000 1111 1101 R2=0000 0000 0000 0001

SLL R1 R1 R2 //Shift Left Logical R1 by 1 bit Would result in R1=1110 0001 1111 1010

Similarly.. R1=1111 0000 1111 1101 R2=0000 0000 0000 0001

SRL R1 R1 R2 //Shift Right Logical R1 by 1 bit Would result in R1=0111 1000 0111 1110