The type of the operand expression of the unary ~
operator must be a primitive
integral type, or a compile-time error occurs. Unary numeric promotion (§5.6.1) is
performed on the operand. The type of the unary bitwise complement expression
is the promoted type of the operand.
At run time, the value of the unary bitwise complement expression is the bitwise complement of the promoted value of the operand; note that, in all cases, ~x
equals (-x)-1
.