What are the three types of bitwise shifts?
Explain a logical shift
All binary bits move the number of stated places to the left or right
It doesn't account for the sign bit
How is a logical shift padded?
MSB/LSB is padded with a 0
Explain an arithmetic shift
All binary bits move the stated number of places to the left or right
It accounts for the sign bit
What is the effect of an arithmetic shift?
Each shifted place is a factor of 2, left multiplies, right divides
How is an arithmetic shift padded?
The MSB is padded with a 0 for a positive or a 1 for a negative
Explain a circular shift
The LSB becomes the MSB, or vice versa
What is the effect of a circular shift?
No bits are lost
What are the three types of binary masks?
What is the purpose of an AND mask?
Extracts a subset of bits in the value
What is the purpose of an OR mask?
Sets a subset of bits to the value
What is the purpose of an XOR mask?
Toggles a subset of the bits