Search⌘ K
AI Features

Shift Operations

Explore how shift operations manipulate bits by moving them left or right in binary numbers, effectively multiplying or dividing by powers of two. Understand their role in efficient computation and bit sequence handling, crucial for computer science foundations.

Shift operations

Shift operations involve shifting the bits in a binary number to the left or right. Thus they are appropriately named right shift and left shift.

Left shift

Left shifting a binary number is equivalent to multiplying it with 22. A left shift is represented with <<.

To perform a left shift by 11 we:

  • Remove the most significant bit
  • Append a 00 as the least significant bit

For example:

00100010 << ...