O'Reilly logo

Art of Computer Programming, Volume 4A, The: Combinatorial Algorithms, Part 1 by Donald E. Knuth

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.1.3. Bitwise Tricks and Techniques

Now comes the fun part: We get to use Boolean operations in our programs.

People are more familiar with arithmetic operations like addition, subtraction, and multiplication than they are with bitwise operations such as “and,” “exclusive-or,” and so on, because arithmetic has a very long history. But we will see that Boolean operations on binary numbers deserve to be much better known. Indeed, they’re an important component of every good programmer’s toolkit.

Early machine designers provided fullword bitwise operations in their computers primarily because such instructions could be included in a machine’s repertoire almost for free. Binary logic seemed to be potentially useful, although only a few applications ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required