Only one bit is used for a sign (negative or positive)
Int32 31 , . . MSDN
Int32.MaxValue = 2^31 - 1 = 01111111111111111111111111111111
Int32.MinValue = -2^31 = 10000000000000000000000000000000
, .
0xFFFFFFFF. :
1111 1111 1111 1111 1111 1111 1111 1111
? ( ) 1, , . , : 1 , , 0 , 0 .
, , . ? , (0 1 1 0) .
, :
0000 0000 0000 0000 0000 0000 0000 0000
.
0000 0000 0000 0000 0000 0000 0000 0001
, 0xFFFFFFFF 0x00000001, 1. , 0xFFFFFFFF -1.
, . -30 2 , 30:
0000 0000 0000 0000 0000 0000 0001 1110
.
1111 1111 1111 1111 1111 1111 1110 0001
.
1111 1111 1111 1111 1111 1111 1110 0010
, 0xFFFFFFE2
,
CPU . 8- . 4 .
7 = 00000111
4 = 00000100
4
1 00000100 0 1 1 0
00000100 -> 11111011
2
11111011
00000001
11111100
7-4 = 7 + ( 4)
00000111 (binary representation of 7)
11111100 (binary representation after Two complement of 4)
========
00000011 (binary representation of 3)