01 VISUAL CSCOMPUTER SCIENCE / 01

THE BINARY PLAYGROUND

Small shift.
Big difference.

What does << actually do? Change a number, move its bits, and watch the math happen.

Bit shift lab

UNSIGNED · 8 BITS
Try it:
STARTING REGISTERClick any bit to flip it
Ready to explore

CURRENT VALUE

45

Every position has a 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₂
01 / POSITION

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.

02 / THE EDGE

Eight slots. That’s it.

An unsigned 8-bit register holds 0–255. Bits that leave the edge are lost, and empty positions fill with zeros.

03 / YOUR TURN

Predict the result.

Hint: there is no slot for 256.

02 / ALGORITHM ARENA

Do more. Touch fewer bits.

Explore how the representation of data changes the work an algorithm has to do.

INTERACTIVE · 32-BIT WORDS

Input A:
A

Click a bit to flip it. Most significant bit on the left; bit 0 on the right. Editing resets the comparison.

STRAIGHTFORWARD /

0iterations

BITWISE /

0iterations / word operations

UNDER THE HOOD

AND

HOW THE WORK SCALES

Count work, not milliseconds.

● Baseline● Bitwise