История изменений
Исправление fsb4000, (текущая версия) :
Вот что в стандарте С++20 написано:
For each of the standard signed integer types, there exists a corresponding (but different) standard unsigned integer type: "unsigned char", "unsigned short int", "unsigned int", "unsigned long int", and "unsigned long long int". Likewise, for each of the extended signed integer types, there exists a corresponding extended unsigned integer type. The standard and extended unsigned integer types are collectively called unsigned integer types. An unsigned integer type has the same range exponent N as the corresponding signed integer type. The range of representable values for the unsigned type is 0 to 2N-1 (inclusive); arithmetic for the unsigned type is performed modulo 2N. [ Note: Unsigned arithmetic does not overflow. Overflow for signed arithmetic yields undefined behavior (7.1 [expr.pre]). -- end note ]
An unsigned integer type , each of which occupies the same amount of storage and has the same object representation, value representation, and alignment requirements (6.6.5 [basic.align]) as the corresponding signed integer type. For each value x of a signed integer type, the value of the corresponding unsigned integer type congruent to x modulo 2N has the same value of corresponding bits in its value representation. [ Footnote: This is also known as two's complement representation. ] [ Example: The value -1 of a signed integer type has the same representation as the largest value of the corresponding unsigned type. ]
The range exponent of each signed integer type shall not be less than the values specified in table X.
type minimum range exponent N
signed char 8
short 16
int 16
long 32
long long 64
Исходная версия fsb4000, :
Вот что в стандарте написано:
For each of the standard signed integer types, there exists a corresponding (but different) standard unsigned integer type: "unsigned char", "unsigned short int", "unsigned int", "unsigned long int", and "unsigned long long int". Likewise, for each of the extended signed integer types, there exists a corresponding extended unsigned integer type. The standard and extended unsigned integer types are collectively called unsigned integer types. An unsigned integer type has the same range exponent N as the corresponding signed integer type. The range of representable values for the unsigned type is 0 to 2N-1 (inclusive); arithmetic for the unsigned type is performed modulo 2N. [ Note: Unsigned arithmetic does not overflow. Overflow for signed arithmetic yields undefined behavior (7.1 [expr.pre]). -- end note ]
An unsigned integer type , each of which occupies the same amount of storage and has the same object representation, value representation, and alignment requirements (6.6.5 [basic.align]) as the corresponding signed integer type. For each value x of a signed integer type, the value of the corresponding unsigned integer type congruent to x modulo 2N has the same value of corresponding bits in its value representation. [ Footnote: This is also known as two's complement representation. ] [ Example: The value -1 of a signed integer type has the same representation as the largest value of the corresponding unsigned type. ]
The range exponent of each signed integer type shall not be less than the values specified in table X.
type minimum range exponent N
signed char 8
short 16
int 16
long 32
long long 64