Search code examples
bit-manipulationbitbit-shift

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?


Solution

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