Explanation of Bitwise NOT Operator

See two’s complement for the representation of negative integers in many languages. As you can see, -2 is represented by 1111110; if you invert all those bits you get 0000001, i.e. a value of 1.

Leave a Comment