Logical binary shifts
Watch the whole lecture free
Make a free account to watch every lecture to the end: 6 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.
That was the teaching part. The rest of this lecture is free with an account: 6 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.
No password needed now: we email you a link to set one. Already have an account? Sign in, then come back to this page.
The teaching part (1 min) is free to watch. A free account opens the whole lecture: 6 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.
What this lecture covers
- A trick computers love
- What a logical shift is
- Left shift, one place
- Why it doubles
- Left shift, two places
Read the transcript of the teaching part
Last time
Before we start: last time, in Binary addition and overflow, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.
A trick computers love
Here is a trick computers use all the time. Take a binary number and slide every bit one place to the left. The number doubles, instantly, with no adding at all. That slide is called a logical shift.
What a logical shift is
A logical shift has three rules. Every bit moves the same number of places, left or right. Bits that move out of the register are lost. And the empty places are filled with zeros.
Left shift, one place
Here is twenty-two, 00010110. Shift it one place left. Every bit moves one column left, and a zero comes in on the right. The result is 0 0 1 0 1 1 0 0, which is forty-four. Twenty-two times two.
Why it doubles
Why does it double? Each column is worth twice the column on its right. Move every bit one column left, and every one is now worth twice as much. So the whole number doubles.
Left shift, two places
Forty-five is 00101101. Shift it two places left. Two zeros come in on the right. The answer is 1 0 1 1 0 1 0 0, which is one hundred and eighty. Two places means times two, times two: times four.
Chapter 1.4: Logical shifts
- Logical binary shifts 6 min
Also for IGCSE Computer Science 0478
Which topics come up most in IGCSE Computer Science 0478 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.