Opentopia Directory Encyclopedia Tools

Logical shift

Encyclopedia : L : LO : LOG : Logical shift


In computer science, a logical shift is a shift operator that shifts all the bits of its operand. Unlike an arithmetic shift, a logical shift does not preserve a number's sign bit or distinguish a number's exponent from its mantissa; every bit in the operand is simply moved a given number of bit positions, and the vacant bit-positions are filled in, generally with zeros (compare with a circular shift).

A logical shift is often used when its operand is being treated as a sequence of bits rather than as a number.

Example

If the bit sequence 0110 1111 1010 0011 were subjected to a logical shift of four bit positions to the left, the resulting bit sequence would be 1111 1010 0011 0000

Note that the farthest-left quartet of bits, 0110, was lost in the operation, and the rightmost 4 bit positions were filled in with zeros.

For a simpler explanation, the bit sequence 0111 1001 which is subjected to a logical left shift of two bit position would yield the bit sequence 1110 0100.

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.

Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: