
A collection of small programming tricks for working with integers and bits.
Henry S. Warren Jr., an IBM researcher who worked on systems from the IBM 704 to the PowerPC, collected small programming tricks over his career and published them in 2002. The book presents fast bit-level and low-level arithmetic algorithms for common tasks, such as counting the 1-bits in a word or speeding up division by using multiplication. It does not deal with large techniques such as sophisticated sorting or compiler optimisation, but with tricks that involve individual computer words or instructions, often mixing arithmetic and logical operations.
Most tricks work only on machines that represent integers in two's complement, and a 32-bit machine is assumed where register length matters, though most adapt easily. Examples are in C and in assembler for a RISC architecture similar to PowerPC. Apart from the introduction, the chapters are independent, each on one subject: manipulating individual bits, overflow detection, rounding to powers of two, checking bounds, and counting total, leading and trailing zeros, among others. Guy L. Steele's foreword names compiler writers and authors of high-performance code as its audience.
Compiler writers, systems programmers and anyone writing performance-critical low-level code.
Chosen by shared topics, the entries that hold them, and the people who recommended both.
MIT's introductory computer science text, taught through Lisp and Scheme.
Recommended by: Bret Victor, Patrick Collison, Paul Graham and 1 other
Computing taught as an extension of arithmetic, with programs as recursive functions.
“One of the most unique and effective pedagogic books ever written.” — Bret Victor
Source: Links — Bret Victor (his five-star list)
Recommended by: Bret Victor, Paul Graham, Susan J. Fowler
Advanced work on type systems and how they capture programs' run-time behaviour.
Recommended by: Patrick Collison
A reference on cryptography for programmers, with code in C.
Recommended by: Patrick Collison
Linear algebra taught through applications in computer science.
Recommended by: Patrick Collison
A textbook on formal languages, automata and computational complexity.
Recommended by: Eric Weinstein