Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

Source Link
Edwin Buck
  • 71.2k
  • 7
  • 103
  • 145

It is a clever means of encoding negative integers in such a way that approximately half of the combination of bits of a data type are reserved for negative integers, and the addition of most of the negative integers with their corresponding positive integers results in a carry overflow that leaves the result to be binary zero.

So, in 2's complement if one is 0x0001 then -1 is 0x1111, because that will result in a combined sum of 0x0000 (with an overflow of 1).

Post Made Community Wiki by Edwin Buck

AltStyle によって変換されたページ (->オリジナル) /