user13626482
user13626482

Reputation:

What is the difference between arithmetic shift left and logical shift left?

I know that arithmetic shift right preserves the MSB and logical shift right doesn't. But what is the difference between arithmetic shift left and logical shift left?

Upvotes: 1

Views: 1077

Answers (2)

siniarskimar
siniarskimar

Reputation: 66

The purpose of arithmetic shift is to preserve the MSB.

In the case of a left shift, arithmetic and logic shift do the same operation.

In the case of a right shift, arithmetic shift preserves MSB and rest of the bits are shifted right

Wikipedia article

Upvotes: 1

Gautum Subhash
Gautum Subhash

Reputation: 60

They are the same operation. Both shift the bits to the left and adds a '0' to the LSB.

Upvotes: 3

Related Questions