Quiz Entry - updated: 2026.07.07
How does multiplication work at the bit level?
Multiplying two w-bit numbers can need up to 2w bits, but C keeps only the low w bits (i.e. the result mod 2^w).
Multiplying two w-bit numbers can produce up to 2w bits:
u × v can be as large as (2^w - 1)² = 2^{2w} - 2^{w+1} + 1
C behavior: Keeps only the low w bits (equivalent to mod 2^w)
// Both signed and unsigned multiplication
// keep the same low-order bits
unsigned ux = x, uy = y;
// Same bit pattern!
(x * y) truncated == (ux * uy) truncated
Consequence: Signed and unsigned multiplication produce the same low-order bits.