Logical Operations
Previous
Next
This page will provide a brief review and explanation of the common logical bitwise operations AND, OR, XOR (Exclusive OR) and NOT.
Logical operations are performed between two
data bits (except for NOT). Bits can be either "1" or "0", and these operations are essential to performing digital math operations.
In the "truth tables" below, the input bits are in bold, and the results are plain.
AND
The logical AND operation compares 2 bits and if they are both "1", then the result is "1", otherwise, the result is "0".
OR
The logical OR operation compares 2 bits and if either or both bits are "1", then the result is "1", otherwise, the result is "0".
XOR
The logical XOR (Exclusive OR) operation compares 2 bits and if exactly one of them is "1" (i.e., if they are different values), then the result is "1"; otherwise (if the bits are the same), the result is "0".
NOT
The logical NOT operation simply changes the value of a single bit. If it is a "1", the result is "0"; if it is a "0", the result is "1".
Note that this operation is different in that instead of comparing two bits, it is acting on a single bit.
Previous
Next
Updated
January 25, 2007
Copyright © 1996-2007 by Ralph
Becker <
> send me Feedback!