xref: /aosp_15_r20/external/clang/lib/Headers/stdint.h (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li /*===---- stdint.h - Standard header for sized integer types --------------===*\
2*67e74705SXin Li  *
3*67e74705SXin Li  * Copyright (c) 2009 Chris Lattner
4*67e74705SXin Li  *
5*67e74705SXin Li  * Permission is hereby granted, free of charge, to any person obtaining a copy
6*67e74705SXin Li  * of this software and associated documentation files (the "Software"), to deal
7*67e74705SXin Li  * in the Software without restriction, including without limitation the rights
8*67e74705SXin Li  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9*67e74705SXin Li  * copies of the Software, and to permit persons to whom the Software is
10*67e74705SXin Li  * furnished to do so, subject to the following conditions:
11*67e74705SXin Li  *
12*67e74705SXin Li  * The above copyright notice and this permission notice shall be included in
13*67e74705SXin Li  * all copies or substantial portions of the Software.
14*67e74705SXin Li  *
15*67e74705SXin Li  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*67e74705SXin Li  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*67e74705SXin Li  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18*67e74705SXin Li  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*67e74705SXin Li  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20*67e74705SXin Li  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21*67e74705SXin Li  * THE SOFTWARE.
22*67e74705SXin Li  *
23*67e74705SXin Li \*===----------------------------------------------------------------------===*/
24*67e74705SXin Li 
25*67e74705SXin Li #ifndef __CLANG_STDINT_H
26*67e74705SXin Li #define __CLANG_STDINT_H
27*67e74705SXin Li 
28*67e74705SXin Li /* If we're hosted, fall back to the system's stdint.h, which might have
29*67e74705SXin Li  * additional definitions.
30*67e74705SXin Li  */
31*67e74705SXin Li #if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
32*67e74705SXin Li 
33*67e74705SXin Li // C99 7.18.3 Limits of other integer types
34*67e74705SXin Li //
35*67e74705SXin Li //  Footnote 219, 220: C++ implementations should define these macros only when
36*67e74705SXin Li //  __STDC_LIMIT_MACROS is defined before <stdint.h> is included.
37*67e74705SXin Li //
38*67e74705SXin Li //  Footnote 222: C++ implementations should define these macros only when
39*67e74705SXin Li //  __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
40*67e74705SXin Li //
41*67e74705SXin Li // C++11 [cstdint.syn]p2:
42*67e74705SXin Li //
43*67e74705SXin Li //  The macros defined by <cstdint> are provided unconditionally. In particular,
44*67e74705SXin Li //  the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in
45*67e74705SXin Li //  footnotes 219, 220, and 222 in the C standard) play no role in C++.
46*67e74705SXin Li //
47*67e74705SXin Li // C11 removed the problematic footnotes.
48*67e74705SXin Li //
49*67e74705SXin Li // Work around this inconsistency by always defining those macros in C++ mode,
50*67e74705SXin Li // so that a C library implementation which follows the C99 standard can be
51*67e74705SXin Li // used in C++.
52*67e74705SXin Li # ifdef __cplusplus
53*67e74705SXin Li #  if !defined(__STDC_LIMIT_MACROS)
54*67e74705SXin Li #   define __STDC_LIMIT_MACROS
55*67e74705SXin Li #   define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
56*67e74705SXin Li #  endif
57*67e74705SXin Li #  if !defined(__STDC_CONSTANT_MACROS)
58*67e74705SXin Li #   define __STDC_CONSTANT_MACROS
59*67e74705SXin Li #   define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
60*67e74705SXin Li #  endif
61*67e74705SXin Li # endif
62*67e74705SXin Li 
63*67e74705SXin Li # include_next <stdint.h>
64*67e74705SXin Li 
65*67e74705SXin Li # ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
66*67e74705SXin Li #  undef __STDC_LIMIT_MACROS
67*67e74705SXin Li #  undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
68*67e74705SXin Li # endif
69*67e74705SXin Li # ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
70*67e74705SXin Li #  undef __STDC_CONSTANT_MACROS
71*67e74705SXin Li #  undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
72*67e74705SXin Li # endif
73*67e74705SXin Li 
74*67e74705SXin Li #else
75*67e74705SXin Li 
76*67e74705SXin Li /* C99 7.18.1.1 Exact-width integer types.
77*67e74705SXin Li  * C99 7.18.1.2 Minimum-width integer types.
78*67e74705SXin Li  * C99 7.18.1.3 Fastest minimum-width integer types.
79*67e74705SXin Li  *
80*67e74705SXin Li  * The standard requires that exact-width type be defined for 8-, 16-, 32-, and
81*67e74705SXin Li  * 64-bit types if they are implemented. Other exact width types are optional.
82*67e74705SXin Li  * This implementation defines an exact-width types for every integer width
83*67e74705SXin Li  * that is represented in the standard integer types.
84*67e74705SXin Li  *
85*67e74705SXin Li  * The standard also requires minimum-width types be defined for 8-, 16-, 32-,
86*67e74705SXin Li  * and 64-bit widths regardless of whether there are corresponding exact-width
87*67e74705SXin Li  * types.
88*67e74705SXin Li  *
89*67e74705SXin Li  * To accommodate targets that are missing types that are exactly 8, 16, 32, or
90*67e74705SXin Li  * 64 bits wide, this implementation takes an approach of cascading
91*67e74705SXin Li  * redefintions, redefining __int_leastN_t to successively smaller exact-width
92*67e74705SXin Li  * types. It is therefore important that the types are defined in order of
93*67e74705SXin Li  * descending widths.
94*67e74705SXin Li  *
95*67e74705SXin Li  * We currently assume that the minimum-width types and the fastest
96*67e74705SXin Li  * minimum-width types are the same. This is allowed by the standard, but is
97*67e74705SXin Li  * suboptimal.
98*67e74705SXin Li  *
99*67e74705SXin Li  * In violation of the standard, some targets do not implement a type that is
100*67e74705SXin Li  * wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit).
101*67e74705SXin Li  * To accommodate these targets, a required minimum-width type is only
102*67e74705SXin Li  * defined if there exists an exact-width type of equal or greater width.
103*67e74705SXin Li  */
104*67e74705SXin Li 
105*67e74705SXin Li #ifdef __INT64_TYPE__
106*67e74705SXin Li # ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/
107*67e74705SXin Li typedef __INT64_TYPE__ int64_t;
108*67e74705SXin Li # endif /* __int8_t_defined */
109*67e74705SXin Li typedef __UINT64_TYPE__ uint64_t;
110*67e74705SXin Li # define __int_least64_t int64_t
111*67e74705SXin Li # define __uint_least64_t uint64_t
112*67e74705SXin Li # define __int_least32_t int64_t
113*67e74705SXin Li # define __uint_least32_t uint64_t
114*67e74705SXin Li # define __int_least16_t int64_t
115*67e74705SXin Li # define __uint_least16_t uint64_t
116*67e74705SXin Li # define __int_least8_t int64_t
117*67e74705SXin Li # define __uint_least8_t uint64_t
118*67e74705SXin Li #endif /* __INT64_TYPE__ */
119*67e74705SXin Li 
120*67e74705SXin Li #ifdef __int_least64_t
121*67e74705SXin Li typedef __int_least64_t int_least64_t;
122*67e74705SXin Li typedef __uint_least64_t uint_least64_t;
123*67e74705SXin Li typedef __int_least64_t int_fast64_t;
124*67e74705SXin Li typedef __uint_least64_t uint_fast64_t;
125*67e74705SXin Li #endif /* __int_least64_t */
126*67e74705SXin Li 
127*67e74705SXin Li #ifdef __INT56_TYPE__
128*67e74705SXin Li typedef __INT56_TYPE__ int56_t;
129*67e74705SXin Li typedef __UINT56_TYPE__ uint56_t;
130*67e74705SXin Li typedef int56_t int_least56_t;
131*67e74705SXin Li typedef uint56_t uint_least56_t;
132*67e74705SXin Li typedef int56_t int_fast56_t;
133*67e74705SXin Li typedef uint56_t uint_fast56_t;
134*67e74705SXin Li # define __int_least32_t int56_t
135*67e74705SXin Li # define __uint_least32_t uint56_t
136*67e74705SXin Li # define __int_least16_t int56_t
137*67e74705SXin Li # define __uint_least16_t uint56_t
138*67e74705SXin Li # define __int_least8_t int56_t
139*67e74705SXin Li # define __uint_least8_t uint56_t
140*67e74705SXin Li #endif /* __INT56_TYPE__ */
141*67e74705SXin Li 
142*67e74705SXin Li 
143*67e74705SXin Li #ifdef __INT48_TYPE__
144*67e74705SXin Li typedef __INT48_TYPE__ int48_t;
145*67e74705SXin Li typedef __UINT48_TYPE__ uint48_t;
146*67e74705SXin Li typedef int48_t int_least48_t;
147*67e74705SXin Li typedef uint48_t uint_least48_t;
148*67e74705SXin Li typedef int48_t int_fast48_t;
149*67e74705SXin Li typedef uint48_t uint_fast48_t;
150*67e74705SXin Li # define __int_least32_t int48_t
151*67e74705SXin Li # define __uint_least32_t uint48_t
152*67e74705SXin Li # define __int_least16_t int48_t
153*67e74705SXin Li # define __uint_least16_t uint48_t
154*67e74705SXin Li # define __int_least8_t int48_t
155*67e74705SXin Li # define __uint_least8_t uint48_t
156*67e74705SXin Li #endif /* __INT48_TYPE__ */
157*67e74705SXin Li 
158*67e74705SXin Li 
159*67e74705SXin Li #ifdef __INT40_TYPE__
160*67e74705SXin Li typedef __INT40_TYPE__ int40_t;
161*67e74705SXin Li typedef __UINT40_TYPE__ uint40_t;
162*67e74705SXin Li typedef int40_t int_least40_t;
163*67e74705SXin Li typedef uint40_t uint_least40_t;
164*67e74705SXin Li typedef int40_t int_fast40_t;
165*67e74705SXin Li typedef uint40_t uint_fast40_t;
166*67e74705SXin Li # define __int_least32_t int40_t
167*67e74705SXin Li # define __uint_least32_t uint40_t
168*67e74705SXin Li # define __int_least16_t int40_t
169*67e74705SXin Li # define __uint_least16_t uint40_t
170*67e74705SXin Li # define __int_least8_t int40_t
171*67e74705SXin Li # define __uint_least8_t uint40_t
172*67e74705SXin Li #endif /* __INT40_TYPE__ */
173*67e74705SXin Li 
174*67e74705SXin Li 
175*67e74705SXin Li #ifdef __INT32_TYPE__
176*67e74705SXin Li 
177*67e74705SXin Li # ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/
178*67e74705SXin Li typedef __INT32_TYPE__ int32_t;
179*67e74705SXin Li # endif /* __int8_t_defined */
180*67e74705SXin Li 
181*67e74705SXin Li # ifndef __uint32_t_defined  /* more glibc compatibility */
182*67e74705SXin Li # define __uint32_t_defined
183*67e74705SXin Li typedef __UINT32_TYPE__ uint32_t;
184*67e74705SXin Li # endif /* __uint32_t_defined */
185*67e74705SXin Li 
186*67e74705SXin Li # define __int_least32_t int32_t
187*67e74705SXin Li # define __uint_least32_t uint32_t
188*67e74705SXin Li # define __int_least16_t int32_t
189*67e74705SXin Li # define __uint_least16_t uint32_t
190*67e74705SXin Li # define __int_least8_t int32_t
191*67e74705SXin Li # define __uint_least8_t uint32_t
192*67e74705SXin Li #endif /* __INT32_TYPE__ */
193*67e74705SXin Li 
194*67e74705SXin Li #ifdef __int_least32_t
195*67e74705SXin Li typedef __int_least32_t int_least32_t;
196*67e74705SXin Li typedef __uint_least32_t uint_least32_t;
197*67e74705SXin Li typedef __int_least32_t int_fast32_t;
198*67e74705SXin Li typedef __uint_least32_t uint_fast32_t;
199*67e74705SXin Li #endif /* __int_least32_t */
200*67e74705SXin Li 
201*67e74705SXin Li #ifdef __INT24_TYPE__
202*67e74705SXin Li typedef __INT24_TYPE__ int24_t;
203*67e74705SXin Li typedef __UINT24_TYPE__ uint24_t;
204*67e74705SXin Li typedef int24_t int_least24_t;
205*67e74705SXin Li typedef uint24_t uint_least24_t;
206*67e74705SXin Li typedef int24_t int_fast24_t;
207*67e74705SXin Li typedef uint24_t uint_fast24_t;
208*67e74705SXin Li # define __int_least16_t int24_t
209*67e74705SXin Li # define __uint_least16_t uint24_t
210*67e74705SXin Li # define __int_least8_t int24_t
211*67e74705SXin Li # define __uint_least8_t uint24_t
212*67e74705SXin Li #endif /* __INT24_TYPE__ */
213*67e74705SXin Li 
214*67e74705SXin Li #ifdef __INT16_TYPE__
215*67e74705SXin Li #ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/
216*67e74705SXin Li typedef __INT16_TYPE__ int16_t;
217*67e74705SXin Li #endif /* __int8_t_defined */
218*67e74705SXin Li typedef __UINT16_TYPE__ uint16_t;
219*67e74705SXin Li # define __int_least16_t int16_t
220*67e74705SXin Li # define __uint_least16_t uint16_t
221*67e74705SXin Li # define __int_least8_t int16_t
222*67e74705SXin Li # define __uint_least8_t uint16_t
223*67e74705SXin Li #endif /* __INT16_TYPE__ */
224*67e74705SXin Li 
225*67e74705SXin Li #ifdef __int_least16_t
226*67e74705SXin Li typedef __int_least16_t int_least16_t;
227*67e74705SXin Li typedef __uint_least16_t uint_least16_t;
228*67e74705SXin Li typedef __int_least16_t int_fast16_t;
229*67e74705SXin Li typedef __uint_least16_t uint_fast16_t;
230*67e74705SXin Li #endif /* __int_least16_t */
231*67e74705SXin Li 
232*67e74705SXin Li 
233*67e74705SXin Li #ifdef __INT8_TYPE__
234*67e74705SXin Li #ifndef __int8_t_defined  /* glibc sys/types.h also defines int8_t*/
235*67e74705SXin Li typedef __INT8_TYPE__ int8_t;
236*67e74705SXin Li #endif /* __int8_t_defined */
237*67e74705SXin Li typedef __UINT8_TYPE__ uint8_t;
238*67e74705SXin Li # define __int_least8_t int8_t
239*67e74705SXin Li # define __uint_least8_t uint8_t
240*67e74705SXin Li #endif /* __INT8_TYPE__ */
241*67e74705SXin Li 
242*67e74705SXin Li #ifdef __int_least8_t
243*67e74705SXin Li typedef __int_least8_t int_least8_t;
244*67e74705SXin Li typedef __uint_least8_t uint_least8_t;
245*67e74705SXin Li typedef __int_least8_t int_fast8_t;
246*67e74705SXin Li typedef __uint_least8_t uint_fast8_t;
247*67e74705SXin Li #endif /* __int_least8_t */
248*67e74705SXin Li 
249*67e74705SXin Li /* prevent glibc sys/types.h from defining conflicting types */
250*67e74705SXin Li #ifndef __int8_t_defined
251*67e74705SXin Li # define __int8_t_defined
252*67e74705SXin Li #endif /* __int8_t_defined */
253*67e74705SXin Li 
254*67e74705SXin Li /* C99 7.18.1.4 Integer types capable of holding object pointers.
255*67e74705SXin Li  */
256*67e74705SXin Li #define __stdint_join3(a,b,c) a ## b ## c
257*67e74705SXin Li 
258*67e74705SXin Li #define  __intn_t(n) __stdint_join3( int, n, _t)
259*67e74705SXin Li #define __uintn_t(n) __stdint_join3(uint, n, _t)
260*67e74705SXin Li 
261*67e74705SXin Li #ifndef _INTPTR_T
262*67e74705SXin Li #ifndef __intptr_t_defined
263*67e74705SXin Li typedef  __intn_t(__INTPTR_WIDTH__)  intptr_t;
264*67e74705SXin Li #define __intptr_t_defined
265*67e74705SXin Li #define _INTPTR_T
266*67e74705SXin Li #endif
267*67e74705SXin Li #endif
268*67e74705SXin Li 
269*67e74705SXin Li #ifndef _UINTPTR_T
270*67e74705SXin Li typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t;
271*67e74705SXin Li #define _UINTPTR_T
272*67e74705SXin Li #endif
273*67e74705SXin Li 
274*67e74705SXin Li /* C99 7.18.1.5 Greatest-width integer types.
275*67e74705SXin Li  */
276*67e74705SXin Li typedef __INTMAX_TYPE__  intmax_t;
277*67e74705SXin Li typedef __UINTMAX_TYPE__ uintmax_t;
278*67e74705SXin Li 
279*67e74705SXin Li /* C99 7.18.4 Macros for minimum-width integer constants.
280*67e74705SXin Li  *
281*67e74705SXin Li  * The standard requires that integer constant macros be defined for all the
282*67e74705SXin Li  * minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width
283*67e74705SXin Li  * types are required, the corresponding integer constant macros are defined
284*67e74705SXin Li  * here. This implementation also defines minimum-width types for every other
285*67e74705SXin Li  * integer width that the target implements, so corresponding macros are
286*67e74705SXin Li  * defined below, too.
287*67e74705SXin Li  *
288*67e74705SXin Li  * These macros are defined using the same successive-shrinking approach as
289*67e74705SXin Li  * the type definitions above. It is likewise important that macros are defined
290*67e74705SXin Li  * in order of decending width.
291*67e74705SXin Li  *
292*67e74705SXin Li  * Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
293*67e74705SXin Li  * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
294*67e74705SXin Li  */
295*67e74705SXin Li 
296*67e74705SXin Li #define __int_c_join(a, b) a ## b
297*67e74705SXin Li #define __int_c(v, suffix) __int_c_join(v, suffix)
298*67e74705SXin Li #define __uint_c(v, suffix) __int_c_join(v##U, suffix)
299*67e74705SXin Li 
300*67e74705SXin Li 
301*67e74705SXin Li #ifdef __INT64_TYPE__
302*67e74705SXin Li # ifdef __INT64_C_SUFFIX__
303*67e74705SXin Li #  define __int64_c_suffix __INT64_C_SUFFIX__
304*67e74705SXin Li #  define __int32_c_suffix __INT64_C_SUFFIX__
305*67e74705SXin Li #  define __int16_c_suffix __INT64_C_SUFFIX__
306*67e74705SXin Li #  define  __int8_c_suffix __INT64_C_SUFFIX__
307*67e74705SXin Li # else
308*67e74705SXin Li #  undef __int64_c_suffix
309*67e74705SXin Li #  undef __int32_c_suffix
310*67e74705SXin Li #  undef __int16_c_suffix
311*67e74705SXin Li #  undef  __int8_c_suffix
312*67e74705SXin Li # endif /* __INT64_C_SUFFIX__ */
313*67e74705SXin Li #endif /* __INT64_TYPE__ */
314*67e74705SXin Li 
315*67e74705SXin Li #ifdef __int_least64_t
316*67e74705SXin Li # ifdef __int64_c_suffix
317*67e74705SXin Li #  define INT64_C(v) __int_c(v, __int64_c_suffix)
318*67e74705SXin Li #  define UINT64_C(v) __uint_c(v, __int64_c_suffix)
319*67e74705SXin Li # else
320*67e74705SXin Li #  define INT64_C(v) v
321*67e74705SXin Li #  define UINT64_C(v) v ## U
322*67e74705SXin Li # endif /* __int64_c_suffix */
323*67e74705SXin Li #endif /* __int_least64_t */
324*67e74705SXin Li 
325*67e74705SXin Li 
326*67e74705SXin Li #ifdef __INT56_TYPE__
327*67e74705SXin Li # ifdef __INT56_C_SUFFIX__
328*67e74705SXin Li #  define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
329*67e74705SXin Li #  define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
330*67e74705SXin Li #  define __int32_c_suffix __INT56_C_SUFFIX__
331*67e74705SXin Li #  define __int16_c_suffix __INT56_C_SUFFIX__
332*67e74705SXin Li #  define __int8_c_suffix  __INT56_C_SUFFIX__
333*67e74705SXin Li # else
334*67e74705SXin Li #  define INT56_C(v) v
335*67e74705SXin Li #  define UINT56_C(v) v ## U
336*67e74705SXin Li #  undef __int32_c_suffix
337*67e74705SXin Li #  undef __int16_c_suffix
338*67e74705SXin Li #  undef  __int8_c_suffix
339*67e74705SXin Li # endif /* __INT56_C_SUFFIX__ */
340*67e74705SXin Li #endif /* __INT56_TYPE__ */
341*67e74705SXin Li 
342*67e74705SXin Li 
343*67e74705SXin Li #ifdef __INT48_TYPE__
344*67e74705SXin Li # ifdef __INT48_C_SUFFIX__
345*67e74705SXin Li #  define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
346*67e74705SXin Li #  define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
347*67e74705SXin Li #  define __int32_c_suffix __INT48_C_SUFFIX__
348*67e74705SXin Li #  define __int16_c_suffix __INT48_C_SUFFIX__
349*67e74705SXin Li #  define __int8_c_suffix  __INT48_C_SUFFIX__
350*67e74705SXin Li # else
351*67e74705SXin Li #  define INT48_C(v) v
352*67e74705SXin Li #  define UINT48_C(v) v ## U
353*67e74705SXin Li #  undef __int32_c_suffix
354*67e74705SXin Li #  undef __int16_c_suffix
355*67e74705SXin Li #  undef  __int8_c_suffix
356*67e74705SXin Li # endif /* __INT48_C_SUFFIX__ */
357*67e74705SXin Li #endif /* __INT48_TYPE__ */
358*67e74705SXin Li 
359*67e74705SXin Li 
360*67e74705SXin Li #ifdef __INT40_TYPE__
361*67e74705SXin Li # ifdef __INT40_C_SUFFIX__
362*67e74705SXin Li #  define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
363*67e74705SXin Li #  define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
364*67e74705SXin Li #  define __int32_c_suffix __INT40_C_SUFFIX__
365*67e74705SXin Li #  define __int16_c_suffix __INT40_C_SUFFIX__
366*67e74705SXin Li #  define __int8_c_suffix  __INT40_C_SUFFIX__
367*67e74705SXin Li # else
368*67e74705SXin Li #  define INT40_C(v) v
369*67e74705SXin Li #  define UINT40_C(v) v ## U
370*67e74705SXin Li #  undef __int32_c_suffix
371*67e74705SXin Li #  undef __int16_c_suffix
372*67e74705SXin Li #  undef  __int8_c_suffix
373*67e74705SXin Li # endif /* __INT40_C_SUFFIX__ */
374*67e74705SXin Li #endif /* __INT40_TYPE__ */
375*67e74705SXin Li 
376*67e74705SXin Li 
377*67e74705SXin Li #ifdef __INT32_TYPE__
378*67e74705SXin Li # ifdef __INT32_C_SUFFIX__
379*67e74705SXin Li #  define __int32_c_suffix __INT32_C_SUFFIX__
380*67e74705SXin Li #  define __int16_c_suffix __INT32_C_SUFFIX__
381*67e74705SXin Li #  define __int8_c_suffix  __INT32_C_SUFFIX__
382*67e74705SXin Li #else
383*67e74705SXin Li #  undef __int32_c_suffix
384*67e74705SXin Li #  undef __int16_c_suffix
385*67e74705SXin Li #  undef  __int8_c_suffix
386*67e74705SXin Li # endif /* __INT32_C_SUFFIX__ */
387*67e74705SXin Li #endif /* __INT32_TYPE__ */
388*67e74705SXin Li 
389*67e74705SXin Li #ifdef __int_least32_t
390*67e74705SXin Li # ifdef __int32_c_suffix
391*67e74705SXin Li #  define INT32_C(v) __int_c(v, __int32_c_suffix)
392*67e74705SXin Li #  define UINT32_C(v) __uint_c(v, __int32_c_suffix)
393*67e74705SXin Li # else
394*67e74705SXin Li #  define INT32_C(v) v
395*67e74705SXin Li #  define UINT32_C(v) v ## U
396*67e74705SXin Li # endif /* __int32_c_suffix */
397*67e74705SXin Li #endif /* __int_least32_t */
398*67e74705SXin Li 
399*67e74705SXin Li 
400*67e74705SXin Li #ifdef __INT24_TYPE__
401*67e74705SXin Li # ifdef __INT24_C_SUFFIX__
402*67e74705SXin Li #  define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
403*67e74705SXin Li #  define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
404*67e74705SXin Li #  define __int16_c_suffix __INT24_C_SUFFIX__
405*67e74705SXin Li #  define __int8_c_suffix  __INT24_C_SUFFIX__
406*67e74705SXin Li # else
407*67e74705SXin Li #  define INT24_C(v) v
408*67e74705SXin Li #  define UINT24_C(v) v ## U
409*67e74705SXin Li #  undef __int16_c_suffix
410*67e74705SXin Li #  undef  __int8_c_suffix
411*67e74705SXin Li # endif /* __INT24_C_SUFFIX__ */
412*67e74705SXin Li #endif /* __INT24_TYPE__ */
413*67e74705SXin Li 
414*67e74705SXin Li 
415*67e74705SXin Li #ifdef __INT16_TYPE__
416*67e74705SXin Li # ifdef __INT16_C_SUFFIX__
417*67e74705SXin Li #  define __int16_c_suffix __INT16_C_SUFFIX__
418*67e74705SXin Li #  define __int8_c_suffix  __INT16_C_SUFFIX__
419*67e74705SXin Li #else
420*67e74705SXin Li #  undef __int16_c_suffix
421*67e74705SXin Li #  undef  __int8_c_suffix
422*67e74705SXin Li # endif /* __INT16_C_SUFFIX__ */
423*67e74705SXin Li #endif /* __INT16_TYPE__ */
424*67e74705SXin Li 
425*67e74705SXin Li #ifdef __int_least16_t
426*67e74705SXin Li # ifdef __int16_c_suffix
427*67e74705SXin Li #  define INT16_C(v) __int_c(v, __int16_c_suffix)
428*67e74705SXin Li #  define UINT16_C(v) __uint_c(v, __int16_c_suffix)
429*67e74705SXin Li # else
430*67e74705SXin Li #  define INT16_C(v) v
431*67e74705SXin Li #  define UINT16_C(v) v ## U
432*67e74705SXin Li # endif /* __int16_c_suffix */
433*67e74705SXin Li #endif /* __int_least16_t */
434*67e74705SXin Li 
435*67e74705SXin Li 
436*67e74705SXin Li #ifdef __INT8_TYPE__
437*67e74705SXin Li # ifdef __INT8_C_SUFFIX__
438*67e74705SXin Li #  define __int8_c_suffix __INT8_C_SUFFIX__
439*67e74705SXin Li #else
440*67e74705SXin Li #  undef  __int8_c_suffix
441*67e74705SXin Li # endif /* __INT8_C_SUFFIX__ */
442*67e74705SXin Li #endif /* __INT8_TYPE__ */
443*67e74705SXin Li 
444*67e74705SXin Li #ifdef __int_least8_t
445*67e74705SXin Li # ifdef __int8_c_suffix
446*67e74705SXin Li #  define INT8_C(v) __int_c(v, __int8_c_suffix)
447*67e74705SXin Li #  define UINT8_C(v) __uint_c(v, __int8_c_suffix)
448*67e74705SXin Li # else
449*67e74705SXin Li #  define INT8_C(v) v
450*67e74705SXin Li #  define UINT8_C(v) v ## U
451*67e74705SXin Li # endif /* __int8_c_suffix */
452*67e74705SXin Li #endif /* __int_least8_t */
453*67e74705SXin Li 
454*67e74705SXin Li 
455*67e74705SXin Li /* C99 7.18.2.1 Limits of exact-width integer types.
456*67e74705SXin Li  * C99 7.18.2.2 Limits of minimum-width integer types.
457*67e74705SXin Li  * C99 7.18.2.3 Limits of fastest minimum-width integer types.
458*67e74705SXin Li  *
459*67e74705SXin Li  * The presence of limit macros are completely optional in C99.  This
460*67e74705SXin Li  * implementation defines limits for all of the types (exact- and
461*67e74705SXin Li  * minimum-width) that it defines above, using the limits of the minimum-width
462*67e74705SXin Li  * type for any types that do not have exact-width representations.
463*67e74705SXin Li  *
464*67e74705SXin Li  * As in the type definitions, this section takes an approach of
465*67e74705SXin Li  * successive-shrinking to determine which limits to use for the standard (8,
466*67e74705SXin Li  * 16, 32, 64) bit widths when they don't have exact representations. It is
467*67e74705SXin Li  * therefore important that the defintions be kept in order of decending
468*67e74705SXin Li  * widths.
469*67e74705SXin Li  *
470*67e74705SXin Li  * Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the
471*67e74705SXin Li  * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
472*67e74705SXin Li  */
473*67e74705SXin Li 
474*67e74705SXin Li #ifdef __INT64_TYPE__
475*67e74705SXin Li # define INT64_MAX           INT64_C( 9223372036854775807)
476*67e74705SXin Li # define INT64_MIN         (-INT64_C( 9223372036854775807)-1)
477*67e74705SXin Li # define UINT64_MAX         UINT64_C(18446744073709551615)
478*67e74705SXin Li # define __INT_LEAST64_MIN   INT64_MIN
479*67e74705SXin Li # define __INT_LEAST64_MAX   INT64_MAX
480*67e74705SXin Li # define __UINT_LEAST64_MAX UINT64_MAX
481*67e74705SXin Li # define __INT_LEAST32_MIN   INT64_MIN
482*67e74705SXin Li # define __INT_LEAST32_MAX   INT64_MAX
483*67e74705SXin Li # define __UINT_LEAST32_MAX UINT64_MAX
484*67e74705SXin Li # define __INT_LEAST16_MIN   INT64_MIN
485*67e74705SXin Li # define __INT_LEAST16_MAX   INT64_MAX
486*67e74705SXin Li # define __UINT_LEAST16_MAX UINT64_MAX
487*67e74705SXin Li # define __INT_LEAST8_MIN    INT64_MIN
488*67e74705SXin Li # define __INT_LEAST8_MAX    INT64_MAX
489*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT64_MAX
490*67e74705SXin Li #endif /* __INT64_TYPE__ */
491*67e74705SXin Li 
492*67e74705SXin Li #ifdef __INT_LEAST64_MIN
493*67e74705SXin Li # define INT_LEAST64_MIN   __INT_LEAST64_MIN
494*67e74705SXin Li # define INT_LEAST64_MAX   __INT_LEAST64_MAX
495*67e74705SXin Li # define UINT_LEAST64_MAX __UINT_LEAST64_MAX
496*67e74705SXin Li # define INT_FAST64_MIN    __INT_LEAST64_MIN
497*67e74705SXin Li # define INT_FAST64_MAX    __INT_LEAST64_MAX
498*67e74705SXin Li # define UINT_FAST64_MAX  __UINT_LEAST64_MAX
499*67e74705SXin Li #endif /* __INT_LEAST64_MIN */
500*67e74705SXin Li 
501*67e74705SXin Li 
502*67e74705SXin Li #ifdef __INT56_TYPE__
503*67e74705SXin Li # define INT56_MAX           INT56_C(36028797018963967)
504*67e74705SXin Li # define INT56_MIN         (-INT56_C(36028797018963967)-1)
505*67e74705SXin Li # define UINT56_MAX         UINT56_C(72057594037927935)
506*67e74705SXin Li # define INT_LEAST56_MIN     INT56_MIN
507*67e74705SXin Li # define INT_LEAST56_MAX     INT56_MAX
508*67e74705SXin Li # define UINT_LEAST56_MAX   UINT56_MAX
509*67e74705SXin Li # define INT_FAST56_MIN      INT56_MIN
510*67e74705SXin Li # define INT_FAST56_MAX      INT56_MAX
511*67e74705SXin Li # define UINT_FAST56_MAX    UINT56_MAX
512*67e74705SXin Li # define __INT_LEAST32_MIN   INT56_MIN
513*67e74705SXin Li # define __INT_LEAST32_MAX   INT56_MAX
514*67e74705SXin Li # define __UINT_LEAST32_MAX UINT56_MAX
515*67e74705SXin Li # define __INT_LEAST16_MIN   INT56_MIN
516*67e74705SXin Li # define __INT_LEAST16_MAX   INT56_MAX
517*67e74705SXin Li # define __UINT_LEAST16_MAX UINT56_MAX
518*67e74705SXin Li # define __INT_LEAST8_MIN    INT56_MIN
519*67e74705SXin Li # define __INT_LEAST8_MAX    INT56_MAX
520*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT56_MAX
521*67e74705SXin Li #endif /* __INT56_TYPE__ */
522*67e74705SXin Li 
523*67e74705SXin Li 
524*67e74705SXin Li #ifdef __INT48_TYPE__
525*67e74705SXin Li # define INT48_MAX           INT48_C(140737488355327)
526*67e74705SXin Li # define INT48_MIN         (-INT48_C(140737488355327)-1)
527*67e74705SXin Li # define UINT48_MAX         UINT48_C(281474976710655)
528*67e74705SXin Li # define INT_LEAST48_MIN     INT48_MIN
529*67e74705SXin Li # define INT_LEAST48_MAX     INT48_MAX
530*67e74705SXin Li # define UINT_LEAST48_MAX   UINT48_MAX
531*67e74705SXin Li # define INT_FAST48_MIN      INT48_MIN
532*67e74705SXin Li # define INT_FAST48_MAX      INT48_MAX
533*67e74705SXin Li # define UINT_FAST48_MAX    UINT48_MAX
534*67e74705SXin Li # define __INT_LEAST32_MIN   INT48_MIN
535*67e74705SXin Li # define __INT_LEAST32_MAX   INT48_MAX
536*67e74705SXin Li # define __UINT_LEAST32_MAX UINT48_MAX
537*67e74705SXin Li # define __INT_LEAST16_MIN   INT48_MIN
538*67e74705SXin Li # define __INT_LEAST16_MAX   INT48_MAX
539*67e74705SXin Li # define __UINT_LEAST16_MAX UINT48_MAX
540*67e74705SXin Li # define __INT_LEAST8_MIN    INT48_MIN
541*67e74705SXin Li # define __INT_LEAST8_MAX    INT48_MAX
542*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT48_MAX
543*67e74705SXin Li #endif /* __INT48_TYPE__ */
544*67e74705SXin Li 
545*67e74705SXin Li 
546*67e74705SXin Li #ifdef __INT40_TYPE__
547*67e74705SXin Li # define INT40_MAX           INT40_C(549755813887)
548*67e74705SXin Li # define INT40_MIN         (-INT40_C(549755813887)-1)
549*67e74705SXin Li # define UINT40_MAX         UINT40_C(1099511627775)
550*67e74705SXin Li # define INT_LEAST40_MIN     INT40_MIN
551*67e74705SXin Li # define INT_LEAST40_MAX     INT40_MAX
552*67e74705SXin Li # define UINT_LEAST40_MAX   UINT40_MAX
553*67e74705SXin Li # define INT_FAST40_MIN      INT40_MIN
554*67e74705SXin Li # define INT_FAST40_MAX      INT40_MAX
555*67e74705SXin Li # define UINT_FAST40_MAX    UINT40_MAX
556*67e74705SXin Li # define __INT_LEAST32_MIN   INT40_MIN
557*67e74705SXin Li # define __INT_LEAST32_MAX   INT40_MAX
558*67e74705SXin Li # define __UINT_LEAST32_MAX UINT40_MAX
559*67e74705SXin Li # define __INT_LEAST16_MIN   INT40_MIN
560*67e74705SXin Li # define __INT_LEAST16_MAX   INT40_MAX
561*67e74705SXin Li # define __UINT_LEAST16_MAX UINT40_MAX
562*67e74705SXin Li # define __INT_LEAST8_MIN    INT40_MIN
563*67e74705SXin Li # define __INT_LEAST8_MAX    INT40_MAX
564*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT40_MAX
565*67e74705SXin Li #endif /* __INT40_TYPE__ */
566*67e74705SXin Li 
567*67e74705SXin Li 
568*67e74705SXin Li #ifdef __INT32_TYPE__
569*67e74705SXin Li # define INT32_MAX           INT32_C(2147483647)
570*67e74705SXin Li # define INT32_MIN         (-INT32_C(2147483647)-1)
571*67e74705SXin Li # define UINT32_MAX         UINT32_C(4294967295)
572*67e74705SXin Li # define __INT_LEAST32_MIN   INT32_MIN
573*67e74705SXin Li # define __INT_LEAST32_MAX   INT32_MAX
574*67e74705SXin Li # define __UINT_LEAST32_MAX UINT32_MAX
575*67e74705SXin Li # define __INT_LEAST16_MIN   INT32_MIN
576*67e74705SXin Li # define __INT_LEAST16_MAX   INT32_MAX
577*67e74705SXin Li # define __UINT_LEAST16_MAX UINT32_MAX
578*67e74705SXin Li # define __INT_LEAST8_MIN    INT32_MIN
579*67e74705SXin Li # define __INT_LEAST8_MAX    INT32_MAX
580*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT32_MAX
581*67e74705SXin Li #endif /* __INT32_TYPE__ */
582*67e74705SXin Li 
583*67e74705SXin Li #ifdef __INT_LEAST32_MIN
584*67e74705SXin Li # define INT_LEAST32_MIN   __INT_LEAST32_MIN
585*67e74705SXin Li # define INT_LEAST32_MAX   __INT_LEAST32_MAX
586*67e74705SXin Li # define UINT_LEAST32_MAX __UINT_LEAST32_MAX
587*67e74705SXin Li # define INT_FAST32_MIN    __INT_LEAST32_MIN
588*67e74705SXin Li # define INT_FAST32_MAX    __INT_LEAST32_MAX
589*67e74705SXin Li # define UINT_FAST32_MAX  __UINT_LEAST32_MAX
590*67e74705SXin Li #endif /* __INT_LEAST32_MIN */
591*67e74705SXin Li 
592*67e74705SXin Li 
593*67e74705SXin Li #ifdef __INT24_TYPE__
594*67e74705SXin Li # define INT24_MAX           INT24_C(8388607)
595*67e74705SXin Li # define INT24_MIN         (-INT24_C(8388607)-1)
596*67e74705SXin Li # define UINT24_MAX         UINT24_C(16777215)
597*67e74705SXin Li # define INT_LEAST24_MIN     INT24_MIN
598*67e74705SXin Li # define INT_LEAST24_MAX     INT24_MAX
599*67e74705SXin Li # define UINT_LEAST24_MAX   UINT24_MAX
600*67e74705SXin Li # define INT_FAST24_MIN      INT24_MIN
601*67e74705SXin Li # define INT_FAST24_MAX      INT24_MAX
602*67e74705SXin Li # define UINT_FAST24_MAX    UINT24_MAX
603*67e74705SXin Li # define __INT_LEAST16_MIN   INT24_MIN
604*67e74705SXin Li # define __INT_LEAST16_MAX   INT24_MAX
605*67e74705SXin Li # define __UINT_LEAST16_MAX UINT24_MAX
606*67e74705SXin Li # define __INT_LEAST8_MIN    INT24_MIN
607*67e74705SXin Li # define __INT_LEAST8_MAX    INT24_MAX
608*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT24_MAX
609*67e74705SXin Li #endif /* __INT24_TYPE__ */
610*67e74705SXin Li 
611*67e74705SXin Li 
612*67e74705SXin Li #ifdef __INT16_TYPE__
613*67e74705SXin Li #define INT16_MAX            INT16_C(32767)
614*67e74705SXin Li #define INT16_MIN          (-INT16_C(32767)-1)
615*67e74705SXin Li #define UINT16_MAX          UINT16_C(65535)
616*67e74705SXin Li # define __INT_LEAST16_MIN   INT16_MIN
617*67e74705SXin Li # define __INT_LEAST16_MAX   INT16_MAX
618*67e74705SXin Li # define __UINT_LEAST16_MAX UINT16_MAX
619*67e74705SXin Li # define __INT_LEAST8_MIN    INT16_MIN
620*67e74705SXin Li # define __INT_LEAST8_MAX    INT16_MAX
621*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT16_MAX
622*67e74705SXin Li #endif /* __INT16_TYPE__ */
623*67e74705SXin Li 
624*67e74705SXin Li #ifdef __INT_LEAST16_MIN
625*67e74705SXin Li # define INT_LEAST16_MIN   __INT_LEAST16_MIN
626*67e74705SXin Li # define INT_LEAST16_MAX   __INT_LEAST16_MAX
627*67e74705SXin Li # define UINT_LEAST16_MAX __UINT_LEAST16_MAX
628*67e74705SXin Li # define INT_FAST16_MIN    __INT_LEAST16_MIN
629*67e74705SXin Li # define INT_FAST16_MAX    __INT_LEAST16_MAX
630*67e74705SXin Li # define UINT_FAST16_MAX  __UINT_LEAST16_MAX
631*67e74705SXin Li #endif /* __INT_LEAST16_MIN */
632*67e74705SXin Li 
633*67e74705SXin Li 
634*67e74705SXin Li #ifdef __INT8_TYPE__
635*67e74705SXin Li # define INT8_MAX            INT8_C(127)
636*67e74705SXin Li # define INT8_MIN          (-INT8_C(127)-1)
637*67e74705SXin Li # define UINT8_MAX          UINT8_C(255)
638*67e74705SXin Li # define __INT_LEAST8_MIN    INT8_MIN
639*67e74705SXin Li # define __INT_LEAST8_MAX    INT8_MAX
640*67e74705SXin Li # define __UINT_LEAST8_MAX  UINT8_MAX
641*67e74705SXin Li #endif /* __INT8_TYPE__ */
642*67e74705SXin Li 
643*67e74705SXin Li #ifdef __INT_LEAST8_MIN
644*67e74705SXin Li # define INT_LEAST8_MIN   __INT_LEAST8_MIN
645*67e74705SXin Li # define INT_LEAST8_MAX   __INT_LEAST8_MAX
646*67e74705SXin Li # define UINT_LEAST8_MAX __UINT_LEAST8_MAX
647*67e74705SXin Li # define INT_FAST8_MIN    __INT_LEAST8_MIN
648*67e74705SXin Li # define INT_FAST8_MAX    __INT_LEAST8_MAX
649*67e74705SXin Li # define UINT_FAST8_MAX  __UINT_LEAST8_MAX
650*67e74705SXin Li #endif /* __INT_LEAST8_MIN */
651*67e74705SXin Li 
652*67e74705SXin Li /* Some utility macros */
653*67e74705SXin Li #define  __INTN_MIN(n)  __stdint_join3( INT, n, _MIN)
654*67e74705SXin Li #define  __INTN_MAX(n)  __stdint_join3( INT, n, _MAX)
655*67e74705SXin Li #define __UINTN_MAX(n)  __stdint_join3(UINT, n, _MAX)
656*67e74705SXin Li #define  __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
657*67e74705SXin Li #define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
658*67e74705SXin Li 
659*67e74705SXin Li /* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
660*67e74705SXin Li /* C99 7.18.3 Limits of other integer types. */
661*67e74705SXin Li 
662*67e74705SXin Li #define  INTPTR_MIN  __INTN_MIN(__INTPTR_WIDTH__)
663*67e74705SXin Li #define  INTPTR_MAX  __INTN_MAX(__INTPTR_WIDTH__)
664*67e74705SXin Li #define UINTPTR_MAX __UINTN_MAX(__INTPTR_WIDTH__)
665*67e74705SXin Li #define PTRDIFF_MIN  __INTN_MIN(__PTRDIFF_WIDTH__)
666*67e74705SXin Li #define PTRDIFF_MAX  __INTN_MAX(__PTRDIFF_WIDTH__)
667*67e74705SXin Li #define    SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__)
668*67e74705SXin Li 
669*67e74705SXin Li /* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
670*67e74705SXin Li  * is enabled. */
671*67e74705SXin Li #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
672*67e74705SXin Li #define   RSIZE_MAX            (SIZE_MAX >> 1)
673*67e74705SXin Li #endif
674*67e74705SXin Li 
675*67e74705SXin Li /* C99 7.18.2.5 Limits of greatest-width integer types. */
676*67e74705SXin Li #define INTMAX_MIN   __INTN_MIN(__INTMAX_WIDTH__)
677*67e74705SXin Li #define INTMAX_MAX   __INTN_MAX(__INTMAX_WIDTH__)
678*67e74705SXin Li #define UINTMAX_MAX __UINTN_MAX(__INTMAX_WIDTH__)
679*67e74705SXin Li 
680*67e74705SXin Li /* C99 7.18.3 Limits of other integer types. */
681*67e74705SXin Li #define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
682*67e74705SXin Li #define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
683*67e74705SXin Li #ifdef __WINT_UNSIGNED__
684*67e74705SXin Li # define WINT_MIN       __UINTN_C(__WINT_WIDTH__, 0)
685*67e74705SXin Li # define WINT_MAX       __UINTN_MAX(__WINT_WIDTH__)
686*67e74705SXin Li #else
687*67e74705SXin Li # define WINT_MIN       __INTN_MIN(__WINT_WIDTH__)
688*67e74705SXin Li # define WINT_MAX       __INTN_MAX(__WINT_WIDTH__)
689*67e74705SXin Li #endif
690*67e74705SXin Li 
691*67e74705SXin Li #ifndef WCHAR_MAX
692*67e74705SXin Li # define WCHAR_MAX __WCHAR_MAX__
693*67e74705SXin Li #endif
694*67e74705SXin Li #ifndef WCHAR_MIN
695*67e74705SXin Li # if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
696*67e74705SXin Li #  define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
697*67e74705SXin Li # else
698*67e74705SXin Li #  define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
699*67e74705SXin Li # endif
700*67e74705SXin Li #endif
701*67e74705SXin Li 
702*67e74705SXin Li /* 7.18.4.2 Macros for greatest-width integer constants. */
703*67e74705SXin Li #define INTMAX_C(v)   __INTN_C(__INTMAX_WIDTH__, v)
704*67e74705SXin Li #define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v)
705*67e74705SXin Li 
706*67e74705SXin Li #endif /* __STDC_HOSTED__ */
707*67e74705SXin Li #endif /* __CLANG_STDINT_H */
708