1919
2020#include <bits/alltypes.h>
2121
22- typedef int8_t int_fast8_t ;
23- typedef int64_t int_fast64_t ;
22+ // XXX EMSCRIPTEN: This file has been modified from the upstream musl version
23+ // to make use of clang pre-defined macros whereever possible, eliminating
24+ // possible inconsistencies.
25+
26+ typedef __INT_FAST8_TYPE__ int_fast8_t ;
27+ typedef __INT_FAST16_TYPE__ int_fast16_t ;
28+ typedef __INT_FAST32_TYPE__ int_fast32_t ;
29+ typedef __INT_FAST64_TYPE__ int_fast64_t ;
30+
31+ typedef __INT_LEAST8_TYPE__ int_least8_t ;
32+ typedef __INT_LEAST16_TYPE__ int_least16_t ;
33+ typedef __INT_LEAST32_TYPE__ int_least32_t ;
34+ typedef __INT_LEAST64_TYPE__ int_least64_t ;
35+
36+ typedef __UINT_FAST8_TYPE__ uint_fast8_t ;
37+ typedef __UINT_FAST16_TYPE__ uint_fast16_t ;
38+ typedef __UINT_FAST32_TYPE__ uint_fast32_t ;
39+ typedef __UINT_FAST64_TYPE__ uint_fast64_t ;
40+
41+ typedef __UINT_LEAST8_TYPE__ uint_least8_t ;
42+ typedef __UINT_LEAST16_TYPE__ uint_least16_t ;
43+ typedef __UINT_LEAST32_TYPE__ uint_least32_t ;
44+ typedef __UINT_LEAST64_TYPE__ uint_least64_t ;
2445
25- typedef int8_t int_least8_t ;
26- typedef int16_t int_least16_t ;
27- typedef int32_t int_least32_t ;
28- typedef int64_t int_least64_t ;
29-
30- typedef uint8_t uint_fast8_t ;
31- typedef uint64_t uint_fast64_t ;
32-
33- typedef uint8_t uint_least8_t ;
34- typedef uint16_t uint_least16_t ;
35- typedef uint32_t uint_least32_t ;
36- typedef uint64_t uint_least64_t ;
37-
38- #ifdef __EMSCRIPTEN__
3946#define INT8_MIN (-1-__INT8_MAX__)
4047#define INT16_MIN (-1-__INT16_MAX__)
4148#define INT32_MIN (-1-__INT32_MAX__)
@@ -50,91 +57,66 @@ typedef uint64_t uint_least64_t;
5057#define UINT16_MAX __UINT16_MAX__
5158#define UINT32_MAX __UINT32_MAX__
5259#define UINT64_MAX __UINT64_MAX__
53- #else
54- #define INT8_MIN (-1-0x7f)
55- #define INT16_MIN (-1-0x7fff)
56- #define INT32_MIN (-1-0x7fffffff)
57- #define INT64_MIN (-1-0x7fffffffffffffff)
58-
59- #define INT8_MAX (0x7f)
60- #define INT16_MAX (0x7fff)
61- #define INT32_MAX (0x7fffffff)
62- #define INT64_MAX (0x7fffffffffffffff)
63-
64- #define UINT8_MAX (0xff)
65- #define UINT16_MAX (0xffff)
66- #define UINT32_MAX (0xffffffffu)
67- #define UINT64_MAX (0xffffffffffffffffu)
68- #endif
69-
70- #define INT_FAST8_MIN INT8_MIN
71- #define INT_FAST64_MIN INT64_MIN
72-
73- #define INT_LEAST8_MIN INT8_MIN
74- #define INT_LEAST16_MIN INT16_MIN
75- #define INT_LEAST32_MIN INT32_MIN
76- #define INT_LEAST64_MIN INT64_MIN
77-
78- #define INT_FAST8_MAX INT8_MAX
79- #define INT_FAST64_MAX INT64_MAX
80-
81- #define INT_LEAST8_MAX INT8_MAX
82- #define INT_LEAST16_MAX INT16_MAX
83- #define INT_LEAST32_MAX INT32_MAX
84- #define INT_LEAST64_MAX INT64_MAX
85-
86- #define UINT_FAST8_MAX UINT8_MAX
87- #define UINT_FAST64_MAX UINT64_MAX
8860
89- #define UINT_LEAST8_MAX UINT8_MAX
90- #define UINT_LEAST16_MAX UINT16_MAX
91- #define UINT_LEAST32_MAX UINT32_MAX
92- #define UINT_LEAST64_MAX UINT64_MAX
93-
94- #define INTMAX_MIN INT64_MIN
95- #define INTMAX_MAX INT64_MAX
96- #define UINTMAX_MAX UINT64_MAX
97-
98- #define WINT_MIN 0U
99- #define WINT_MAX UINT32_MAX
100-
101- #if L'\0' - 1 > 0
102- #define WCHAR_MAX (0xffffffffu+L'\0')
103- #define WCHAR_MIN (0+L'\0')
104- #else
105- #define WCHAR_MAX (0x7fffffff+L'\0')
106- #define WCHAR_MIN (-1-0x7fffffff+L'\0')
107- #endif
61+ #define INT_FAST8_MIN (-1-__INT_FAST8_MAX__)
62+ #define INT_FAST16_MIN (-1-__INT_FAST16_MAX__)
63+ #define INT_FAST32_MIN (-1-__INT_FAST32_MAX__)
64+ #define INT_FAST64_MIN (-1-__INT_FAST64_MAX__)
65+
66+ #define INT_LEAST8_MIN (-1-__INT_LEAST8_MAX__)
67+ #define INT_LEAST16_MIN (-1-__INT_LEAST16_MAX__)
68+ #define INT_LEAST32_MIN (-1-__INT_LEAST32_MAX__)
69+ #define INT_LEAST64_MIN (-1-__INT_LEAST64_MAX__)
70+
71+ #define INT_FAST8_MAX __INT_FAST8_MAX__
72+ #define INT_FAST16_MAX __INT_FAST16_MAX__
73+ #define INT_FAST32_MAX __INT_FAST32_MAX__
74+ #define INT_FAST64_MAX __INT_FAST64_MAX__
75+
76+ #define INT_LEAST8_MAX __INT_LEAST8_MAX__
77+ #define INT_LEAST16_MAX __INT_LEAST16_MAX__
78+ #define INT_LEAST32_MAX __INT_LEAST32_MAX__
79+ #define INT_LEAST64_MAX __INT_LEAST64_MAX__
80+
81+ #define UINT_FAST8_MAX __UINT_FAST8_MAX__
82+ #define UINT_FAST16_MAX __UINT_FAST16_MAX__
83+ #define UINT_FAST32_MAX __UINT_FAST32_MAX__
84+ #define UINT_FAST64_MAX __UINT_FAST64_MAX__
85+
86+ #define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
87+ #define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
88+ #define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
89+ #define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
90+
91+ #define INTMAX_MIN (-1-__INTMAX_MAX__)
92+ #define INTMAX_MAX __INTMAX_MAX__
93+ #define UINTMAX_MAX __UINTMAX_MAX__
94+
95+ #define WCHAR_MAX __WCHAR_MAX__
96+ #define WINT_MAX __WINT_MAX__
97+ #define INTPTR_MAX __INTPTR_MAX__
98+ #define UINTPTR_MAX __UINTPTR_MAX__
99+ #define PTRDIFF_MAX __PTRDIFF_MAX__
100+ #define SIZE_MAX __SIZE_MAX__
101+
102+ #define WINT_MIN (-1-__WINT_MAX__)
103+ #define WCHAR_MIN (-1-__WCHAR_MAX__)
104+ #define INTPTR_MIN (-1-__INTPTR_MAX__)
105+ #define PTRDIFF_MIN (-1-__PTRDIFF_MAX__)
108106
109107#define SIG_ATOMIC_MIN INT32_MIN
110108#define SIG_ATOMIC_MAX INT32_MAX
111109
112- #include <bits/stdint.h>
113-
114- #define INT8_C (c ) c
115- #define INT16_C (c ) c
116- #define INT32_C (c ) c
117-
118- #define UINT8_C (c ) c
119- #define UINT16_C (c ) c
120- #define UINT32_C (c ) c ## U
121-
122- // XXX EMSCRIPTEN: Use the clang-builtin macros here when available.
123- #ifdef __UINT64_C
124- #define INT64_C __INT64_C
125- #define UINT64_C __UINT64_C
110+ #define INT8_C __INT8_C
111+ #define INT16_C __INT16_C
112+ #define INT32_C __INT32_C
113+ #define INT64_C __INT64_C
126114#define INTMAX_C __INTMAX_C
115+
116+ #define UINT8_C __UINT8_C
117+ #define UINT16_C __UINT16_C
118+ #define UINT32_C __UINT32_C
119+ #define UINT64_C __UINT64_C
127120#define UINTMAX_C __UINTMAX_C
128- #elif UINTPTR_MAX == UINT64_MAX
129- #define INT64_C (c ) c ## L
130- #define UINT64_C (c ) c ## UL
131- #define INTMAX_C (c ) c ## L
132- #define UINTMAX_C (c ) c ## UL
133- #else
134- #define INT64_C (c ) c ## LL
135- #define UINT64_C (c ) c ## ULL
136- #define INTMAX_C (c ) c ## LL
137- #define UINTMAX_C (c ) c ## ULL
138- #endif
139121
140122#endif
0 commit comments