Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 7. Bit Manipulation > 7.1 Logical Operations - Pg. 240

240 Bit Manipulation 7.1 Logical Operations Many high-level languages allow variables of Boolean type, that is, variables that are capable of storing true or false values. Virtually all high-level languages allow expressions with Boolean values to be used in conditional (if) statements. In assembly language the Boolean value true is identified with the bit value 1 and the Boolean value false is identi- fied with the bit value 0. Figure 7.1 gives the definitions of the Boolean operations using bit values as the operands. The or operation is sometimes called "inclusive or" to distin- guish it from "exclusive or" (xor). The only difference between or and xor is for two 1 bits; 1 or 1 is 1, but 1 xor 1 is 0, that is, exclusive or corresponds to one operand or the other true, but not both. bit1 0 0 1 bit2 0 1 0 bit1 and bit2 0 0 0 (a) and operation