25 #ifndef __CLANG_STDINT_H
26 #define __CLANG_STDINT_H
31 #if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
53 # if !defined(__STDC_LIMIT_MACROS)
54 # define __STDC_LIMIT_MACROS
55 # define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
57 # if !defined(__STDC_CONSTANT_MACROS)
58 # define __STDC_CONSTANT_MACROS
59 # define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
63 # include_next <stdint.h>
65 # ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
66 # undef __STDC_LIMIT_MACROS
67 # undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
69 # ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
70 # undef __STDC_CONSTANT_MACROS
71 # undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
105 #ifdef __INT64_TYPE__
106 # ifndef __int8_t_defined
107 typedef __INT64_TYPE__ int64_t;
109 typedef __UINT64_TYPE__ uint64_t;
110 # define __int_least64_t int64_t
111 # define __uint_least64_t uint64_t
112 # define __int_least32_t int64_t
113 # define __uint_least32_t uint64_t
114 # define __int_least16_t int64_t
115 # define __uint_least16_t uint64_t
116 # define __int_least8_t int64_t
117 # define __uint_least8_t uint64_t
120 #ifdef __int_least64_t
121 typedef __int_least64_t int_least64_t;
122 typedef __uint_least64_t uint_least64_t;
123 typedef __int_least64_t int_fast64_t;
124 typedef __uint_least64_t uint_fast64_t;
127 #ifdef __INT56_TYPE__
128 typedef __INT56_TYPE__ int56_t;
129 typedef __UINT56_TYPE__ uint56_t;
130 typedef int56_t int_least56_t;
131 typedef uint56_t uint_least56_t;
132 typedef int56_t int_fast56_t;
133 typedef uint56_t uint_fast56_t;
134 # define __int_least32_t int56_t
135 # define __uint_least32_t uint56_t
136 # define __int_least16_t int56_t
137 # define __uint_least16_t uint56_t
138 # define __int_least8_t int56_t
139 # define __uint_least8_t uint56_t
143 #ifdef __INT48_TYPE__
144 typedef __INT48_TYPE__ int48_t;
145 typedef __UINT48_TYPE__ uint48_t;
146 typedef int48_t int_least48_t;
147 typedef uint48_t uint_least48_t;
148 typedef int48_t int_fast48_t;
149 typedef uint48_t uint_fast48_t;
150 # define __int_least32_t int48_t
151 # define __uint_least32_t uint48_t
152 # define __int_least16_t int48_t
153 # define __uint_least16_t uint48_t
154 # define __int_least8_t int48_t
155 # define __uint_least8_t uint48_t
159 #ifdef __INT40_TYPE__
160 typedef __INT40_TYPE__ int40_t;
161 typedef __UINT40_TYPE__ uint40_t;
162 typedef int40_t int_least40_t;
163 typedef uint40_t uint_least40_t;
164 typedef int40_t int_fast40_t;
165 typedef uint40_t uint_fast40_t;
166 # define __int_least32_t int40_t
167 # define __uint_least32_t uint40_t
168 # define __int_least16_t int40_t
169 # define __uint_least16_t uint40_t
170 # define __int_least8_t int40_t
171 # define __uint_least8_t uint40_t
175 #ifdef __INT32_TYPE__
177 # ifndef __int8_t_defined
178 typedef __INT32_TYPE__ int32_t;
181 # ifndef __uint32_t_defined
182 # define __uint32_t_defined
183 typedef __UINT32_TYPE__ uint32_t;
186 # define __int_least32_t int32_t
187 # define __uint_least32_t uint32_t
188 # define __int_least16_t int32_t
189 # define __uint_least16_t uint32_t
190 # define __int_least8_t int32_t
191 # define __uint_least8_t uint32_t
194 #ifdef __int_least32_t
195 typedef __int_least32_t int_least32_t;
196 typedef __uint_least32_t uint_least32_t;
197 typedef __int_least32_t int_fast32_t;
198 typedef __uint_least32_t uint_fast32_t;
201 #ifdef __INT24_TYPE__
202 typedef __INT24_TYPE__ int24_t;
203 typedef __UINT24_TYPE__ uint24_t;
204 typedef int24_t int_least24_t;
205 typedef uint24_t uint_least24_t;
206 typedef int24_t int_fast24_t;
207 typedef uint24_t uint_fast24_t;
208 # define __int_least16_t int24_t
209 # define __uint_least16_t uint24_t
210 # define __int_least8_t int24_t
211 # define __uint_least8_t uint24_t
214 #ifdef __INT16_TYPE__
215 #ifndef __int8_t_defined
216 typedef __INT16_TYPE__ int16_t;
218 typedef __UINT16_TYPE__ uint16_t;
219 # define __int_least16_t int16_t
220 # define __uint_least16_t uint16_t
221 # define __int_least8_t int16_t
222 # define __uint_least8_t uint16_t
225 #ifdef __int_least16_t
226 typedef __int_least16_t int_least16_t;
227 typedef __uint_least16_t uint_least16_t;
228 typedef __int_least16_t int_fast16_t;
229 typedef __uint_least16_t uint_fast16_t;
234 #ifndef __int8_t_defined
235 typedef __INT8_TYPE__ int8_t;
237 typedef __UINT8_TYPE__ uint8_t;
238 # define __int_least8_t int8_t
239 # define __uint_least8_t uint8_t
242 #ifdef __int_least8_t
243 typedef __int_least8_t int_least8_t;
244 typedef __uint_least8_t uint_least8_t;
245 typedef __int_least8_t int_fast8_t;
246 typedef __uint_least8_t uint_fast8_t;
250 #ifndef __int8_t_defined
251 # define __int8_t_defined
256 #define __stdint_join3(a,b,c) a ## b ## c
259 #ifndef __intptr_t_defined
261 #define __intptr_t_defined
293 #define __int_c_join(a, b) a ## b
294 #define __int_c(v, suffix) __int_c_join(v, suffix)
295 #define __uint_c(v, suffix) __int_c_join(v##U, suffix)
298 #ifdef __INT64_TYPE__
299 # ifdef __INT64_C_SUFFIX__
300 # define __int64_c_suffix __INT64_C_SUFFIX__
301 # define __int32_c_suffix __INT64_C_SUFFIX__
302 # define __int16_c_suffix __INT64_C_SUFFIX__
303 # define __int8_c_suffix __INT64_C_SUFFIX__
305 # undef __int64_c_suffix
306 # undef __int32_c_suffix
307 # undef __int16_c_suffix
308 # undef __int8_c_suffix
312 #ifdef __int_least64_t
313 # ifdef __int64_c_suffix
314 # define INT64_C(v) __int_c(v, __int64_c_suffix)
315 # define UINT64_C(v) __uint_c(v, __int64_c_suffix)
317 # define INT64_C(v) v
318 # define UINT64_C(v) v ## U
323 #ifdef __INT56_TYPE__
324 # ifdef __INT56_C_SUFFIX__
325 # define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
326 # define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
327 # define __int32_c_suffix __INT56_C_SUFFIX__
328 # define __int16_c_suffix __INT56_C_SUFFIX__
329 # define __int8_c_suffix __INT56_C_SUFFIX__
331 # define INT56_C(v) v
332 # define UINT56_C(v) v ## U
333 # undef __int32_c_suffix
334 # undef __int16_c_suffix
335 # undef __int8_c_suffix
340 #ifdef __INT48_TYPE__
341 # ifdef __INT48_C_SUFFIX__
342 # define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
343 # define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
344 # define __int32_c_suffix __INT48_C_SUFFIX__
345 # define __int16_c_suffix __INT48_C_SUFFIX__
346 # define __int8_c_suffix __INT48_C_SUFFIX__
348 # define INT48_C(v) v
349 # define UINT48_C(v) v ## U
350 # undef __int32_c_suffix
351 # undef __int16_c_suffix
352 # undef __int8_c_suffix
357 #ifdef __INT40_TYPE__
358 # ifdef __INT40_C_SUFFIX__
359 # define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
360 # define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
361 # define __int32_c_suffix __INT40_C_SUFFIX__
362 # define __int16_c_suffix __INT40_C_SUFFIX__
363 # define __int8_c_suffix __INT40_C_SUFFIX__
365 # define INT40_C(v) v
366 # define UINT40_C(v) v ## U
367 # undef __int32_c_suffix
368 # undef __int16_c_suffix
369 # undef __int8_c_suffix
374 #ifdef __INT32_TYPE__
375 # ifdef __INT32_C_SUFFIX__
376 # define __int32_c_suffix __INT32_C_SUFFIX__
377 # define __int16_c_suffix __INT32_C_SUFFIX__
378 # define __int8_c_suffix __INT32_C_SUFFIX__
380 # undef __int32_c_suffix
381 # undef __int16_c_suffix
382 # undef __int8_c_suffix
386 #ifdef __int_least32_t
387 # ifdef __int32_c_suffix
388 # define INT32_C(v) __int_c(v, __int32_c_suffix)
389 # define UINT32_C(v) __uint_c(v, __int32_c_suffix)
391 # define INT32_C(v) v
392 # define UINT32_C(v) v ## U
397 #ifdef __INT24_TYPE__
398 # ifdef __INT24_C_SUFFIX__
399 # define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
400 # define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
401 # define __int16_c_suffix __INT24_C_SUFFIX__
402 # define __int8_c_suffix __INT24_C_SUFFIX__
404 # define INT24_C(v) v
405 # define UINT24_C(v) v ## U
406 # undef __int16_c_suffix
407 # undef __int8_c_suffix
412 #ifdef __INT16_TYPE__
413 # ifdef __INT16_C_SUFFIX__
414 # define __int16_c_suffix __INT16_C_SUFFIX__
415 # define __int8_c_suffix __INT16_C_SUFFIX__
417 # undef __int16_c_suffix
418 # undef __int8_c_suffix
422 #ifdef __int_least16_t
423 # ifdef __int16_c_suffix
424 # define INT16_C(v) __int_c(v, __int16_c_suffix)
425 # define UINT16_C(v) __uint_c(v, __int16_c_suffix)
427 # define INT16_C(v) v
428 # define UINT16_C(v) v ## U
434 # ifdef __INT8_C_SUFFIX__
435 # define __int8_c_suffix __INT8_C_SUFFIX__
437 # undef __int8_c_suffix
441 #ifdef __int_least8_t
442 # ifdef __int8_c_suffix
443 # define INT8_C(v) __int_c(v, __int8_c_suffix)
444 # define UINT8_C(v) __uint_c(v, __int8_c_suffix)
447 # define UINT8_C(v) v ## U
471 #ifdef __INT64_TYPE__
472 # define INT64_MAX INT64_C( 9223372036854775807)
473 # define INT64_MIN (-INT64_C( 9223372036854775807)-1)
474 # define UINT64_MAX UINT64_C(18446744073709551615)
475 # define __INT_LEAST64_MIN INT64_MIN
476 # define __INT_LEAST64_MAX INT64_MAX
477 # define __UINT_LEAST64_MAX UINT64_MAX
478 # define __INT_LEAST32_MIN INT64_MIN
479 # define __INT_LEAST32_MAX INT64_MAX
480 # define __UINT_LEAST32_MAX UINT64_MAX
481 # define __INT_LEAST16_MIN INT64_MIN
482 # define __INT_LEAST16_MAX INT64_MAX
483 # define __UINT_LEAST16_MAX UINT64_MAX
484 # define __INT_LEAST8_MIN INT64_MIN
485 # define __INT_LEAST8_MAX INT64_MAX
486 # define __UINT_LEAST8_MAX UINT64_MAX
489 #ifdef __INT_LEAST64_MIN
490 # define INT_LEAST64_MIN __INT_LEAST64_MIN
491 # define INT_LEAST64_MAX __INT_LEAST64_MAX
492 # define UINT_LEAST64_MAX __UINT_LEAST64_MAX
493 # define INT_FAST64_MIN __INT_LEAST64_MIN
494 # define INT_FAST64_MAX __INT_LEAST64_MAX
495 # define UINT_FAST64_MAX __UINT_LEAST64_MAX
499 #ifdef __INT56_TYPE__
500 # define INT56_MAX INT56_C(36028797018963967)
501 # define INT56_MIN (-INT56_C(36028797018963967)-1)
502 # define UINT56_MAX UINT56_C(72057594037927935)
503 # define INT_LEAST56_MIN INT56_MIN
504 # define INT_LEAST56_MAX INT56_MAX
505 # define UINT_LEAST56_MAX UINT56_MAX
506 # define INT_FAST56_MIN INT56_MIN
507 # define INT_FAST56_MAX INT56_MAX
508 # define UINT_FAST56_MAX UINT56_MAX
509 # define __INT_LEAST32_MIN INT56_MIN
510 # define __INT_LEAST32_MAX INT56_MAX
511 # define __UINT_LEAST32_MAX UINT56_MAX
512 # define __INT_LEAST16_MIN INT56_MIN
513 # define __INT_LEAST16_MAX INT56_MAX
514 # define __UINT_LEAST16_MAX UINT56_MAX
515 # define __INT_LEAST8_MIN INT56_MIN
516 # define __INT_LEAST8_MAX INT56_MAX
517 # define __UINT_LEAST8_MAX UINT56_MAX
521 #ifdef __INT48_TYPE__
522 # define INT48_MAX INT48_C(140737488355327)
523 # define INT48_MIN (-INT48_C(140737488355327)-1)
524 # define UINT48_MAX UINT48_C(281474976710655)
525 # define INT_LEAST48_MIN INT48_MIN
526 # define INT_LEAST48_MAX INT48_MAX
527 # define UINT_LEAST48_MAX UINT48_MAX
528 # define INT_FAST48_MIN INT48_MIN
529 # define INT_FAST48_MAX INT48_MAX
530 # define UINT_FAST48_MAX UINT48_MAX
531 # define __INT_LEAST32_MIN INT48_MIN
532 # define __INT_LEAST32_MAX INT48_MAX
533 # define __UINT_LEAST32_MAX UINT48_MAX
534 # define __INT_LEAST16_MIN INT48_MIN
535 # define __INT_LEAST16_MAX INT48_MAX
536 # define __UINT_LEAST16_MAX UINT48_MAX
537 # define __INT_LEAST8_MIN INT48_MIN
538 # define __INT_LEAST8_MAX INT48_MAX
539 # define __UINT_LEAST8_MAX UINT48_MAX
543 #ifdef __INT40_TYPE__
544 # define INT40_MAX INT40_C(549755813887)
545 # define INT40_MIN (-INT40_C(549755813887)-1)
546 # define UINT40_MAX UINT40_C(1099511627775)
547 # define INT_LEAST40_MIN INT40_MIN
548 # define INT_LEAST40_MAX INT40_MAX
549 # define UINT_LEAST40_MAX UINT40_MAX
550 # define INT_FAST40_MIN INT40_MIN
551 # define INT_FAST40_MAX INT40_MAX
552 # define UINT_FAST40_MAX UINT40_MAX
553 # define __INT_LEAST32_MIN INT40_MIN
554 # define __INT_LEAST32_MAX INT40_MAX
555 # define __UINT_LEAST32_MAX UINT40_MAX
556 # define __INT_LEAST16_MIN INT40_MIN
557 # define __INT_LEAST16_MAX INT40_MAX
558 # define __UINT_LEAST16_MAX UINT40_MAX
559 # define __INT_LEAST8_MIN INT40_MIN
560 # define __INT_LEAST8_MAX INT40_MAX
561 # define __UINT_LEAST8_MAX UINT40_MAX
565 #ifdef __INT32_TYPE__
566 # define INT32_MAX INT32_C(2147483647)
567 # define INT32_MIN (-INT32_C(2147483647)-1)
568 # define UINT32_MAX UINT32_C(4294967295)
569 # define __INT_LEAST32_MIN INT32_MIN
570 # define __INT_LEAST32_MAX INT32_MAX
571 # define __UINT_LEAST32_MAX UINT32_MAX
572 # define __INT_LEAST16_MIN INT32_MIN
573 # define __INT_LEAST16_MAX INT32_MAX
574 # define __UINT_LEAST16_MAX UINT32_MAX
575 # define __INT_LEAST8_MIN INT32_MIN
576 # define __INT_LEAST8_MAX INT32_MAX
577 # define __UINT_LEAST8_MAX UINT32_MAX
580 #ifdef __INT_LEAST32_MIN
581 # define INT_LEAST32_MIN __INT_LEAST32_MIN
582 # define INT_LEAST32_MAX __INT_LEAST32_MAX
583 # define UINT_LEAST32_MAX __UINT_LEAST32_MAX
584 # define INT_FAST32_MIN __INT_LEAST32_MIN
585 # define INT_FAST32_MAX __INT_LEAST32_MAX
586 # define UINT_FAST32_MAX __UINT_LEAST32_MAX
590 #ifdef __INT24_TYPE__
591 # define INT24_MAX INT24_C(8388607)
592 # define INT24_MIN (-INT24_C(8388607)-1)
593 # define UINT24_MAX UINT24_C(16777215)
594 # define INT_LEAST24_MIN INT24_MIN
595 # define INT_LEAST24_MAX INT24_MAX
596 # define UINT_LEAST24_MAX UINT24_MAX
597 # define INT_FAST24_MIN INT24_MIN
598 # define INT_FAST24_MAX INT24_MAX
599 # define UINT_FAST24_MAX UINT24_MAX
600 # define __INT_LEAST16_MIN INT24_MIN
601 # define __INT_LEAST16_MAX INT24_MAX
602 # define __UINT_LEAST16_MAX UINT24_MAX
603 # define __INT_LEAST8_MIN INT24_MIN
604 # define __INT_LEAST8_MAX INT24_MAX
605 # define __UINT_LEAST8_MAX UINT24_MAX
609 #ifdef __INT16_TYPE__
610 #define INT16_MAX INT16_C(32767)
611 #define INT16_MIN (-INT16_C(32767)-1)
612 #define UINT16_MAX UINT16_C(65535)
613 # define __INT_LEAST16_MIN INT16_MIN
614 # define __INT_LEAST16_MAX INT16_MAX
615 # define __UINT_LEAST16_MAX UINT16_MAX
616 # define __INT_LEAST8_MIN INT16_MIN
617 # define __INT_LEAST8_MAX INT16_MAX
618 # define __UINT_LEAST8_MAX UINT16_MAX
621 #ifdef __INT_LEAST16_MIN
622 # define INT_LEAST16_MIN __INT_LEAST16_MIN
623 # define INT_LEAST16_MAX __INT_LEAST16_MAX
624 # define UINT_LEAST16_MAX __UINT_LEAST16_MAX
625 # define INT_FAST16_MIN __INT_LEAST16_MIN
626 # define INT_FAST16_MAX __INT_LEAST16_MAX
627 # define UINT_FAST16_MAX __UINT_LEAST16_MAX
632 # define INT8_MAX INT8_C(127)
633 # define INT8_MIN (-INT8_C(127)-1)
634 # define UINT8_MAX UINT8_C(255)
635 # define __INT_LEAST8_MIN INT8_MIN
636 # define __INT_LEAST8_MAX INT8_MAX
637 # define __UINT_LEAST8_MAX UINT8_MAX
640 #ifdef __INT_LEAST8_MIN
641 # define INT_LEAST8_MIN __INT_LEAST8_MIN
642 # define INT_LEAST8_MAX __INT_LEAST8_MAX
643 # define UINT_LEAST8_MAX __UINT_LEAST8_MAX
644 # define INT_FAST8_MIN __INT_LEAST8_MIN
645 # define INT_FAST8_MAX __INT_LEAST8_MAX
646 # define UINT_FAST8_MAX __UINT_LEAST8_MAX
650 #define __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
651 #define __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
652 #define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
653 #define __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
654 #define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
659 #define INTPTR_MIN (-__INTPTR_MAX__-1)
660 #define INTPTR_MAX __INTPTR_MAX__
661 #define UINTPTR_MAX __UINTPTR_MAX__
662 #define PTRDIFF_MIN (-__PTRDIFF_MAX__-1)
663 #define PTRDIFF_MAX __PTRDIFF_MAX__
664 #define SIZE_MAX __SIZE_MAX__
668 #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
669 #define RSIZE_MAX (SIZE_MAX >> 1)
673 #define INTMAX_MIN (-__INTMAX_MAX__-1)
674 #define INTMAX_MAX __INTMAX_MAX__
675 #define UINTMAX_MAX __UINTMAX_MAX__
678 #define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
679 #define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
680 #ifdef __WINT_UNSIGNED__
681 # define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
682 # define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
684 # define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
685 # define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
689 # define WCHAR_MAX __WCHAR_MAX__
692 # if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
693 # define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
695 # define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
700 #define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
701 #define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
__UINTPTR_TYPE__ uintptr_t
__UINTMAX_TYPE__ uintmax_t