Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - The expression ~ 10 means (~ 10 10), and it will return the value-1 1 for 01. This figure is easy to understand. Turn it upside down bit by bit.
The expression ~ 10 means (~ 10 10), and it will return the value-1 1 for 01. This figure is easy to understand. Turn it upside down bit by bit.
The range of int type (assuming that the int type occupies 2 bytes, otherwise it is too troublesome, then the range it represents is -32768~32767).

The binary of 32767 is 011111165438+.

The binary of ~ 10 is11111165438+.

Therefore, the complement by negative number is: the original code is counted from the right, the first 1 remains unchanged to the right (including the first 1), and the first 1 remains unchanged to the left.

So1111111116544. The first sign bit is 1, which means negative. The value of 10 1 1 is 1 1, so it is-1 1.

You can look at the knowledge of source code, complement and complement. ...