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