Binary shifts operate on the principle of positional notation, where shifting a digit one place to the left in base- multiplies its value by .
A Left Shift by positions is equivalent to multiplying the original decimal value by , provided no significant bits are lost to overflow.
A Right Shift by positions is equivalent to performing integer division by , effectively truncating any remainder.
Identify the Shift Type: Always check if the question specifies 'Logical' or 'Arithmetic' when dealing with right shifts, as this changes the result for negative numbers.
Power of Two Rule: If asked to multiply or divide by a value like 8 or 16, convert it to or to determine the number of shifts ( or places).
Check for Data Loss: When shifting left, verify if the number of bits exceeds the register size. If a '1' is shifted out of an 8-bit register, the result is no longer a simple multiplication by .
Sanity Check: A right shift should always result in a smaller absolute value (integer division). If a negative number becomes positive after a right shift, you likely applied a logical shift instead of an arithmetic one.
The 'Sign Bit' Trap: Students often forget that in an arithmetic right shift, the fill bit is not always 1; it is whatever the MSB was before the shift.
Shifting by Zero: Shifting a number by 0 positions results in the original number; shifting by the word size (e.g., shifting a 32-bit integer by 32) often results in 0 or is undefined in some languages.
Rounding Behavior: Right shifts always round towards negative infinity (floor), which differs from standard decimal division for negative numbers (e.g., , but a right shift might result in depending on the architecture).