What is arithmetic left shift of 01001001?

23,254

For left shift, arithmetic and logical shift are the same.

The difference is for right shift only, where an arithmetic right shift will copy the old MSB to the new MSB after having shifted, thus keeping a negative number from being converted to a positive when shifting.

Wikipedia has a more detailed explanation.

Share:
23,254
user855
Author by

user855

Updated on July 09, 2022

Comments

  • user855
    user855 almost 2 years

    I would think it is 00010010 i.e. it tries to maintain the sign bit as is

    On the other hand, the logical left shift by 1 pos would be 10010010

    Is this correct?