Spokes.wiki Search Graph Growth About

bit-manipulation-wiki

Book source ↗ source url updated Mon Jun 15 2026 00:00:00 GMT+0000 (Coordinated Universal Time)

Hacker’s Delight (Henry S. Warren Jr.)

The canonical textbook of bit manipulation — Henry S. (“Hank”) Warren Jr. (IBM research fellow), Addison-Wesley: 1st ed. 2002 (306 pp), 2nd ed. 2013 (494 pp), foreword by Guy L. Steele. The reference the spoke’s other sources (bit-twiddling-hacks, count-set-bits-so, Stephan Brumme’s bits) repeatedly cite as the authority — and the open-question gap the spoke flagged at spin-out, now closed.

What it covers

Fast bit-level and low-level arithmetic algorithms for common tasks. Across ~12 chapters: integer overflow, counting and rearranging bits/bytes (the population-count family), extracting bits under a mask, permuting bits, multiplying bit matrices, multiword arithmetic, and the famous division/remainder by constants via multiply-and-shift (turning a slow divide into a multiply — the trick compilers now emit automatically). Examples are in C and RISC assembler (a PowerPC-like ISA), with algorithms given as formulas for any word width (examples usually 32-bit). Target audience, per Steele’s foreword: compiler writers and high-performance-code authors.

Why it grounds the spoke

This is the field’s foundational text, so it anchors several of this wiki’s threads at their source:

Tier

T1 — the authoritative primary reference for the field (peer-regarded, foreword by Guy Steele). Provenance note: this page summarizes the book’s scope from secondary sources (Wikipedia / publisher / the foreword), not a full reading; specific in-book derivations are not quoted.

bit-manipulation · population-count · branchless-programming · bit-twiddling-hacks · count-set-bits-so