Summary
Highlights
Using the binary representation of 22 as an example, a left shift by one bit causes the leftmost bit to disappear and all other bits to shift one position to the left. The empty space on the far right is then padded with a zero. This action effectively multiplies the original number by two.
A right binary shift operates similarly but in the opposite direction. Each bit shifts to the right by the specified number of places, with the rightmost bit disappearing and the leftmost empty space being padded with a zero. A right shift by one bit effectively divides the original number by two.
Binary left and right shifts are powerful operations that can be used to perform multiplication and division on binary numbers, respectively. The principle remains consistent whether shifting by one bit or multiple bits.
Binary shifts involve moving all bits in a binary number either to the left or to the right. This video will illustrate the process and outcomes of these shifts.