Same bits. New value.
Move left and each position is worth twice as much. Move right and it is worth half as much; the lowest bit is discarded.
THE BINARY PLAYGROUND
What does << actually do? Change a number, move its bits, and watch the math happen.
CURRENT VALUE
Add the highlighted place values to turn binary into decimal. A left shift moves each bit to a position worth twice as much.
45 = 00101101₂Move left and each position is worth twice as much. Move right and it is worth half as much; the lowest bit is discarded.
An unsigned 8-bit register holds 0–255. Bits that leave the edge are lost, and empty positions fill with zeros.
Hint: there is no slot for 256.
02 / ALGORITHM ARENA
Explore how the representation of data changes the work an algorithm has to do.
Click a bit to flip it. Most significant bit on the left; bit 0 on the right. Editing resets the comparison.
STRAIGHTFORWARD /
BITWISE /
UNDER THE HOOD
HOW THE WORK SCALES