Skip to content

Commit 79dd115

Browse files
committed
SIZE_MAX, UINTPTR_MAX
1 parent c32772f commit 79dd115

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

include/stdint.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,19 @@ typedef unsigned long long uintmax_t;
3636
#define INT64_MAX 9223372036854775807
3737
#define UINT64_MAX 18446744073709551615
3838

39-
#define INTPTR_MAX ((((intptr_t)1) << (sizeof(intptr_t) * 8 - 1)) - 1)
40-
#define INTPTR_MIN (((intptr_t)-1) << (sizeof(intptr_t) * 8 - 1))
41-
4239
#define INTMAX_MIN INT64_MIN
4340
#define INTMAX_MAX INT64_MAX
4441
#define UINTMAX_MAX UINT64_MAX
42+
43+
#if defined(__ILP32__)
44+
#define INTPTR_MIN -2147483648L
45+
#define INTPTR_MAX 2147483647L
46+
#define UINTPTR_MAX 4294967295UL
47+
48+
#else
49+
#define INTPTR_MIN -9223372036854775808L
50+
#define INTPTR_MAX 9223372036854775807L
51+
#define UINTPTR_MAX 18446744073709551615UL
52+
#endif
53+
54+
#define SIZE_MAX UINTPTR_MAX

0 commit comments

Comments
 (0)