I am reading "Chapter 13: Operator Overloading: Doing it Right",
It states Unary Operators
~ (__invert__) Bitwise inverse of an integer, defined as ~x == -(x+1). If x is 2 then ~x == -3.
I am very confused here. How could it be that if x
is 2 then ~x == -3
?
Could you please provide any hints?