Hacker's Delight (2nd Edition) 2nd Edition
Use the Amazon App to scan ISBNs and compare prices.
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Frequently bought together
Customers who bought this item also bought
From the Publisher
“This is the first book that promises to tell the deep, dark secrets of computer arithmetic, and it delivers in spades. It contains every trick I knew plus many, many more. A godsend for library developers, compiler writers, and lovers of elegant hacks, it deserves a spot on your shelf right next to Knuth. In the ten years since the first edition came out, it’s been absolutely invaluable to my work at Sun and Google. I’m thrilled with all of the new material in the second edition.”
— Joshua Bloch
“When I first saw the title, I figured that the book must be either a cookbook for breaking into computers (unlikely) or some sort of compendium of little programming tricks. It’s the latter, but it’s thorough, almost encyclopedic, in its coverage. The second edition covers two new major topics and expands the overall collection with dozens of additional little tricks, including one that I put to use right away in a binary search algorithm: computing the average of two integers without risking overflow. This hacker is indeed delighted!”
— Guy Steele
About the Author
Henry S. Warren, Jr., has had a fifty-year career with IBM, spanning from the IBM 704 to the PowerPC and beyond. He has worked on various military command and control systems and on the SETL (SET Language) project under Jack Schwartz. Since 1973, Hank has been with IBM’s Research Division, focusing on compilers and computer architectures. He currently works on a supercomputer project aimed at an exaflop. Hank received his Ph.D. in computer science from the Courant Institute at New York University.
There was a problem filtering reviews right now. Please try again later.
What I got out of this:
Multiword multiplication for fast high precision fixed point on ARM chips that lack fpus, branchless integer min and max is very handy for Thumb mode, pre-computing magic numbers for division and modulus enables MUCH faster lookups in hash tables, the graphs of functions at the very end are super fascinating, and the superoptimizer this man wrote is very simple but incredibly fun to play with! I adapted it to use multithreading and it's helped me reduce some code to the simplest possible sequence. I've had special success in reducing switch cases or long conditions involving integer arithmetic.
Also I can definitely see uses for other things in the book, like the multibyte addition and the floating point chapter. Theres a little bit in there about the most famous bithack of them all. And the notation used is really clean.
This book is a gem and I hope we get more in the future. For now though I'll settle for leafing through and discovering the things I missed.
The book reads like a textbook and contains a lot of math. Most code is presented in assembly. Explanations are given but don't expect concrete answers. Getting a solution will require a bit of analysis on your part. if you don't like math or thinking things through, do not buy this book. If you have no experience with low/mid level languages, or bitwise operations, you may find yourself a little lost.
I loaned my first edition to a friend, which required that I purchase a copy of the second. The first is good and the second is better. Highly recommended.
Top international reviews
If you are already a proficient programmer looking for ways to speed your code up this is an excellent resource that will be worth looking at. This is not really aimed at a beginner programmer or someone with limited mathematic skills.
Nota: Il concetto di basso livello, nel caso specifico, deve essere inteso e associato esclusivamente alla rappresentazione dei numeri binari e quindi dei bit, il linguaggio utilizzato per gli esempi è tuttavia di alto livello, ovvero il C, ma c'è anche dell'Assembly che può essere considerato effettivamente basso livello, ovvero che dipende dalle caratteristiche hardware della macchina, e della CPU in particolare.
This is not a book, this is a trip among bits (Computer Architecture, Computer Arithmetic, a lot of Math, a lot of C and Assembly).
Comme tout ce qui concerne l'optimisation, ces recettes sont simplement des cordes supplémentaires à l'arc du programmeur, mais rien ne saurait garantir la supériorité universelle d'une de ces recettes, aussi astucieuse soit-elle, sur toutes les architectures. En particulier, la tendance actuelle de nos processeurs à proposer des opérations intégrées de plus en plus complexes (comme l'instruction popcnt), peut invalider à tout moment une solution jusqu'alors excellente.
Ceci étant le lot de toute quête d'optimisation, cela n'enlève rien au charme du livre. C'est même l'un des rares livres qui, dans ce domaine, peut s'enorgueillir d'une certaine universalité, ses astuces se plaçant avant tout sur le plan mathématique.
Achtung: Das ist definitiv ein Buch für "Professionals". Man muss schon einiges an Zeit mitbringen um sich durchzuwühlen.
Man kann es auch gut als Nachschlagewerk für spezielle Probleme verwenden.
I only wish I had discovered it sooner.
Most illuminating take-away: if you can control the carry-bits, addition followed by bit-wise logical operations allow the construction of surprisingly parallel, branch-free routines which normally end up implemented sequentially in a loop.
Best of all, the book reads so easily and entertainingly, without dullness or dryness, written out of much experience and enthusiasm.
If you write compilers, design hardware, or need to optimize some fiddly low-level code, this book fits the bill.