# Logical Shifts

## Understanding Logical Shifts

• Logical Shifts are operations that shift all bits of a binary number to the right or left.
• These types of shifts fill any resulting spaces with 0’s.

## Logical Right Shifts

• A logical right shift pulls all bits one place to the right, with the leftmost bit becoming 0.
• The rightmost bit is discarded.
• For example, if we logically right-shift the binary number 1101 (which is 13 in decimal), we get 0110 (which is 6 in decimal).

## Logical Left Shifts

• A logical left shift pulls all bits one place to the left, with the rightmost bit becoming 0.
• The original leftmost bit is discarded.
• For example, if we logically left-shift the binary number 1101 (which is 13 in decimal), we get 1010 (which is 10 in decimal).

## Practical Use of Logical Shifts

• Logical shifts are extremely useful for multiplication and division by powers of two.
• They provide a quick and efficient way to perform these operations in binary.
• The rules are simple: A logical left shift doubles the original number, while a logical right shift halves the original number (discarding any remainder).

## Important Considerations for Logical Shifts

• A key aspect to remember about logical shifts is that they do not consider the sign of a number. That is, they do not take into account if a number is negative or positive.
• Therefore, logical shifts should be used carefully when dealing with signed (positive or negative) numbers.