jspωiki
Bitwise NOT

Overview#

Bitwise NOT (or complement) is a Bitwise operation, is a unary operation that performs logical negation on each bit, forming the ones' complement of the given binary value. Bits that are 0 become 1, and those that are 1 become 0.

For example:
Bitwise NOT 0111 (decimal 7) = 1000 (decimal 8)

Bitwise NOT is equal to the two's complement of the value minus one. If two's complement arithmetic is used, then Bitwise NOT x = -x − 1.

For unsigned integer, Bitwise NOT of a number is the "mirror reflection" of the number across the half-way point of the unsigned integer's range.
For example, for 8-bit unsigned integers:
Bitwise NOT x = 255 - x
which can be visualized on a graph as a downward line that effectively "flips" an increasing range from 0 to 255, to a decreasing range from 255 to 0. A simple but illustrative example use is to invert a grayscale image where each pixel is stored as an unsigned integer.

More Information#

There might be more information for this subject on one of the following: