Bitwise Operation Website Links For
Operation
 

Information About

Bitwise Operation





BITWISE OPERATORS


NOT

A bitwise NOT or '''complement''' is a Unary Operation which performs logical Negation on each bit. 0 digits become 1, and vice versa. For example:

NOT 0111
= 1000

In the C and C++ programming languages, the NOT operator is "~" (tilde). For example:

x = ~y;
assigns ''x'' the result of "NOT ''y''". This is different from the C and C++ logical "not" operator, "!" (exclamation point), which treats the entire numeral as a single Boolean value. For example:

x = !y;

assigns ''x'' a Boolean value of "true" if ''y'' is "false", or "false" if ''y'' is "true". In C and C++, a numerical value is interpreted as "true" if it is non-zero. The logical "not" is not normally considered a bitwise operation, since it does not operate at the bit level.

Bitwise NOT is useful in finding the One's Complement of a binary numeral, and may be an intermediate step in finding the Two's Complement of the same numeral.


OR

A bitwise OR takes two bit patterns of equal length, and produces another one of the same length by matching up corresponding bits (the first of each; the second of each; and so on) and performing the logical OR operation on each pair of corresponding bits. In each pair, the result is 1 if the first bit is 1 '''OR''' the second bit is 1. Otherwise, the result is zero. For example:

0101
OR 0011
= 0111

  X y z
  { Align right border=0 cellpadding=0 cellspacing=0
  { Align right border=0 cellpadding=0 cellspacing=0