Bitwise NOT Operator (~)

By: Dusty Arlia
Published on March 8, 2013
Last Updated on Sunday, July 05, 2015 at 6:31 PM
Total Updates: 3

Performs a bitwise NOT (negation) on an expression. What this does is inverts the bits of its operands. Using this operator is the same as adding 1 and then negating the result: -(x + 1)

For example:

0000 0101 //this binary number (or base 2) equals 1 + 4 = 5

~5 = 1111 1010 = -6  //Bitwise NOTing 5 equals -6 (base 10) after inverting each bit

Comments:

Ad:

Ad: