Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

strength reduction

A compiler trick that swaps a slow operation for cheaper ones that give the same answer, like a shift instead of a multiply by 8.

Strength reduction replaces an expensive operation with an equivalent cheaper sequence, such as x * 8 with x << 3, x * 5 with lea [x + x*4], or division by a constant with multiplication.

Examples

  • Compilers turn x * 8 into x << 3, and x * 5 into lea eax, [rdi + rdi*4].

Read the full section →