Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How much is it to replace 50000 long plastic with short plastic?
How much is it to replace 50000 long plastic with short plastic?
First of all, whether it is a long integer or a short integer, it is best to understand them with 4-byte complement and 2-byte complement, which is the key to this problem.

Next, convert 50000 into 4-byte complement (32-bit complement) and get:

50000 = (0000 0000 0000 000010000111010000) supplement.

Two-byte complement (short integer) takes the last 16 bit of the above 32-bit binary value (the principle of high and low: the high bit is stored in the high end; The low bit is stored at the low end; High-end and low-end refer to the end with a large number of bytes (address) and the end with a small number of bytes in the memory space), and the following two-byte complement is obtained:

(11000011010000) supplement

The highest bit of this complement is 1, which represents a negative number and needs to be converted into the original code to get the value:

(1011001010000) complement =-(011)

Answer over