在 C 实现中,与任何编程语言的大多数现代实现一样,有符号整数用补码 http://en.wikipedia.org/wiki/Two%27s_complement.
在二进制补码中,高位表示负数,并且值的编码方式如以下示例所示:
Bits Decimal
0…011 +3
0…010 +2
0…001 +1
0…000 0
1…111 -1
1…110 -2
1…101 -3
Thus, if the usual (unsigned) binary value for the bits is n and the high bit is zero, the represented value is +n. However, if the high bit is one, then the represented value is n-2w, where w is the width (the number of bits in the format).
So, in an unsigned 32-bit format, 32 one bits would normally be 4,294,967,295. In a two’s complement 32-bit format, 32 one bits is 4,294,967,295 - 232 = -1.
In your case, the bits you have are 1111 1111 1111 1111 1111 1111 1101 1111. In unsigned 32-bit format, that is 4,294,967,263. In two’s complement, it is 4,294,967,263 - 232 = -33.