two's complement calculator
two's complement (two's complement) 1. in computer systems, values are always represented (stored) in two's complement. the main reason: using complement code, the sign bit and other bits can be processed uniformly; at the same time, subtraction can also be processed as addition. in addition, when two numbers expressed in two's complement are added, if there is a carry in the highest bit (sign bit), the carry is discarded. 2. the conversion process of complement code and original code is almost the same.
for example
1111 1111 255 − 0101 1111 − 95 =========== ===== 1010 0000 (反码ones' complement) 160 + 1 + 1 =========== ===== 1010 0001 (补码two's complement) 161