What is it?:

It’s the moving of Binary of a data type left or right. It actually corresponds to multiplication and division of the binary number:

Left Shifts:

  • Fill in missing space with 0’s.
  • 6 shifted two to the left is 24. Represented as:
  • Shift left by multiplying by

Right Shifts:

Options:

  1. Logical Shift: Fill space with 0’s (for non-numerical data).
  2. Arithmetic Shift: Fill with MSB (for 2’s complement numbers).
  • By shifting right by , that’s the same as dividing by .
  • The difference is logical shift ignores the sign, whereas arithmetic respects it.