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 shift of two bit position would yield the bit sequence 1110 0100.

(This entry is from Wikipedia)

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: