Logical and arithmetic shifts (Edexcel GCSE Computer Science): Flashcards
📚Flashcards
Practise the cards
15 cards from this deck
ShowHide
Practise the cards
15 cards from this deck
What do bit shifts do to binary patterns?
What do bit shifts do to binary patterns?
Move all digits left or right by specified positions
Two common uses of bit shifts
Two common uses of bit shifts
Efficient multiplication/division & bit manipulation
Logical shift left: what fills right spaces
Logical shift left: what fills right spaces
0s
Logical shift left: what happens to leftmost bits
Logical shift left: what happens to leftmost bits
Discarded when pushed off edge
Logical shift right: what fills left spaces
Logical shift right: what fills left spaces
0s
Logical shift right: what happens to rightmost bits
Logical shift right: what happens to rightmost bits
Discarded when they fall off edge
Arithmetic shift right: key difference from logical
Arithmetic shift right: key difference from logical
Fills left with MSB value instead of 0s
What does MSB stand for?
What does MSB stand for?
Most Significant Bit
MSB's role in signed binary numbers
MSB's role in signed binary numbers
Represents the sign (positive or negative)
How arithmetic shift left differs from logical
How arithmetic shift left differs from logical
It doesn't - they work exactly the same
What can happen to precision when shifting numbers
What can happen to precision when shifting numbers
Loss of information/precision
General effect of left shifts on values
General effect of left shifts on values
Multiply by powers of 2
General effect of right shifts on values
General effect of right shifts on values
Divide by powers of 2
0001 0100 logical shift left by 2
0001 0100 logical shift left by 2
0101 0000
1011 1000 logical shift right by 3
1011 1000 logical shift right by 3
0001 0111
