stdint.h: use correct type for INT64_MAX (#11647)
int64_t is signed. Although it does not make a difference by itself, because
INT64_MAX is still a valid number for uint64_t (UL), the later INT64_MIN
declaration depends on INT64_MAX, and therefore got implicitly casted to
unsigned type.
This fixes the following program on a x86_64 system:
#include <stdint.h>
int main() {
int64_t test = 5;
if (test < INT64_MIN)
return 1;
return 0;
}
This is a regression since commit 1d13a609
("stdint.h: define [U]INT64[MAX|MIN]
with [U]L on x86_64").
Signed-off-by: Jerome Duval <jerome.duval@gmail.com>
This commit is contained in:
parent
0305947d0a
commit
d1dc9cf655
|
@ -70,10 +70,10 @@ typedef uint64_t uintmax_t;
|
|||
#define UINT32_MAX (4294967295U)
|
||||
|
||||
#if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ > 4
|
||||
#define INT64_MAX (9223372036854775807UL)
|
||||
#define INT64_MAX (9223372036854775807L)
|
||||
#define UINT64_MAX (18446744073709551615UL)
|
||||
#else
|
||||
#define INT64_MAX (9223372036854775807ULL)
|
||||
#define INT64_MAX (9223372036854775807LL)
|
||||
#define UINT64_MAX (18446744073709551615ULL)
|
||||
#endif
|
||||
#define INT64_MIN (-INT64_MAX-1)
|
||||
|
|
Loading…
Reference in New Issue