Pages: <Previous  28    29    30    31    32    33    34    35    36    37    38  Next >

8 Logic operations

8.3 The AND operation

The AND operation combines two binary words bit by bit according to the rules

0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1

In other words, only when both bits are 1 is the result 1. You may find it helpful to think of it this way: when one bit is one and the other bit is 1 the result is 1.

Example 10

Find the result of 1101 1011 AND 1011 1010.

Answer

The bits in the two words are combined according to the above rules, working along the two words. For instance, the rightmost bit of the result is derived from 1 AND 0 = 0. Doing this for all the bits gives:

so the result is 1001 1010.

Pages: <Previous  28    29    30    31    32    33    34    35    36    37    38  Next >