![]() |
Henry S. Warren, Jr. research staff member "It has to be a labor of love, the other rewards will not be sufficient to justify the effort." |
On the book: Hacker's Delight (2002)
What made you decide to write the book on this topic?
It was a gradual development, not a sudden decision. RISC computers are much more mathematically "clean" than their predecessors, and the basic ALU (Arithmetic Logic Unit) instructions used by most of the manufacturers are very similar. This means that any programming tricks of the trade that you learn or discover for one machine are likely to apply to all the RISCs. These attributes make it much more appealing, to me anyway, to uncover such tricks. I joined the 801 project in 1978, and found that the programmers on that project knew many neat tricks. So I started accumulating them in a script file. This gradually evolved into book size. It was a surprise to realize that there seems to be no other book on the subject matter that Hacker's Delight covers.
How did you go about the research necessary to write such a technical book?
In 1992 I discovered that it is possible to do integer division by any constant by multiplying by a sort of reciprocal, using the 801's Multiply High instruction and a very few other one-cycle instructions. This was intriguing, and I spent a lot of time exploring it. I'm sure a mathematician could have worked out the proofs and explored all the side issues much more quickly than I was able to do. But it was a lot of fun and it resulted in a 38-page Research Report (RC 18601).
I added this material to the script file and it was starting to get kind of big. At this time I thought that if I could come up with some more things like that, it might conceivably result in a book.
So I started exploring some things that I had always wanted to look into, and writing them up. One example is space-filling curves, particularly the Hilbert curve. Another is the question: is there a formula for the nth prime in terms of n (or in terms of all the smaller primes)? This question has nagged me since my high school days. Since then I learned a little about recursive function theory, and was able to apply the techniques of that theory to the formula question. This subject also was a pleasure to explore, and it wound up as a chapter in the script file and then in the book. This material may not be of very high quality; no one has ever commented on it. Quite possibly no one has read it. But anyway, it pretty much answered this very old question for me. One post-publication reviewer said it was out of place in the book. Probably true. I had been aware of that, but I included it anyway. The script file was really just a collection of loosely related things that interested me. And by the way, I don't claim to be an expert in any of them. I am just someone who likes to hack around in programming and an elementary level of mathematics, hence the title.
Incidentally, the title also comes from an old solitaire game called Idiot's Delight. (A little self-disparagement here.)
So, I didn't do much research in the sense of studying all the scholarly journals and textbooks, although there was some of that. It was mostly just talking to people and writing and polishing things up on my own.
![]() |
What are the greatest challenges to you as an author?
Finding the time to write! There are many other topics I'd like to include in Hacker's Delight. These are being accumulated on the Hacker's Delight web site, www.HackersDelight.org, but that site is growing very slowly.
Quality of writing (grammar, style, etc.) is also a concern. For example, changing passive voice to active, and keeping it light. There are two poems (ditties) in Hacker's Delight. These may make a literary person cringe. But the publisher and reviewers didn't comment on these, so they're in there.
Making things clear and simple is difficult. I have written passages that seemed quite clear at the time, but when I read them some months later, I didn't understand them. I have had the same experience with writing a computer program.
Another problem is keeping the errors out. I proof read the book many times. But still, there are a number of errors in the first two printings. For the third printing, the publisher incorporated the fixes that are in an errata sheet on the Hacker's Delight web site.
For this book, notation was a bit of a problem. The subject matter is machine code, but an idea expressed in assembly language is hard to grasp. For simple calculations (no branches or function calls), Hacker's Delight uses an algebraic notation called "computer arithmetic." Variables are in bold face, as often done in vector algebra, to distinguish between computer arithmetic and ordinary arithmetic.
What or who inspires and encourages you to write?
My manager at the time, Martin Hopkins, gave me a lot of encouragement. But it was mainly self-motivation, as it no doubt is with any author.
What advice do you have for aspiring authors?
With only one book behind me and probably no more to come, I may not be in a position to give advice. But I will anyway. It has to be a labor of love, the other rewards will not be sufficient to justify the effort. Choose a good publisher. Addison-Wesley was and continues to be a big help. They advertise it and they had it translated into four languages without any suggestion from me. They did a good job with the book's physical qualities.
Be ready to do a lot of proof reading, always on short notice.
Consider doing the index yourself, if your publisher will allow that. I didn't, and the publisher hired a professional indexer. He was quite capable, but nevertheless the index went through so many revisions that I often wished I had done it myself.
Who are some of your favorite authors today?
With technical books, it's pretty much one book per writer, so it's hard to acquire a taste for a particular one. But Don Knuth is a favorite. He is so thorough, so accurate, so well-researched, and he keeps it interesting. A book I like a lot because of its style, as well as its subject matter, is Paulo Ribenboim's The Little Book of Big Primes. Perhaps I should mention Martin Gardner, for his much missed Mathematical Games column in Scientific American. He is a great writer on that subject.
For nontechnical reading, I enjoy nonfiction adventure stories. For example, I have recently read two books about the explorer Ernest Shackleton, some war stories, and I'm currently struggling with one about Alexander the Great. I have no favorite authors in this area; these books are often very interesting but not usually great literature.
What role did books play in your childhood?
I was not a big reader, but I do remember reading Our Wonder World as a young child. This is an old (1914) encyclopedia-like set of ten volumes with titles like Adventure and Achievement, Story and History, Sports, Invention and Industry, and Amateur Handicraft. It may very well have got me interested in science and building things. And there was Martin Gardner's column. That's about all I can remember, except for being forced in high school to read things like Beowulf.
Hacker's Delight cover photo in Russian, Polish, Japanese, and Chinese
Other books by Henry S Warren
The PowerPC Architecture: A Specification for a New Family of RISC Processors
Morgan Kaufman, 2nd edition 1994 (hard cover)
Editors: Cathy May, Ed Silha, Rick Simpson, and Hank Warren
The PowerPC Compiler Writer's Guide
Published for IBM by Warthman Associates (soft cover)
Editors: Steve Hoxey, Faraydon Karim, Bill Hay, and Hank Warren


