Chapter 10. BIT MANIPULATIONS

Bitwise Logic Operations

In chapter 3, section 3.3, circuits and truth tables for the Boolean operations AND, OR, NOT, and XOR were discussed. The truth table for AND is

p q (p AND q)
1 1 1
1 0 0
0 1 0
0 0 0

and is implemented using the Boolean circuit

Bitwise Logic Operations

If eight of these Boolean circuits are used in parallel, then two eight-bit numbers,

    1111 0101
    1100 0011

when fed into the eight AND gates, result in one eight-bit output:

    1100 0001

The operation is carried out as shown in Figure 10-1. In hex notation, the bytes F5H and C3H used as inputs to a one-byte AND operation have produced the output C1H. This operation can be applied ...

Get Linux Assembly Language Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.