The term ANDing comes from a form of mathematics called Boolean algebra. Computers use Boolean operators in their circuitry. Integrated circuits contain components known as gates and inverters. A gate (or inverter) has one or more inputs. Their output is based on the state of those inputs.The state can only be off (0) or on (1). In Boolean terms, it can only be true (1) or false (0).AND gates will return (or output) 1 if all inputs are 1 and will return 0 if any input is not 1. An OR gate will return 1 if any input is 1 and will return 0 only if no input signals are 1.
You may be familiar with Boolean operators in using search engines.You can refine your search by using Boolean operators, including AND and OR. There are other, less commonly used operators such as NAND (not AND) and XOR (exclusive OR), but these are outside the scope of this discussion.
Bitwise ANDing simply means that we are performing the logical AND function on each bit.The simple AND statements can be expressed as shown here. Rather than a mathematical plus function, this is a comparison between two (or more) values.
Notice that the logical AND function results in a 1 only when both inputs are 1; otherwise, the result is 0. Next, let's take a slightly more complicated example, still using bitwise ANDing.
Was this article helpful?