9 #ifndef __CLANG_STDINT_H
13 #if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__)
14 #define __CLANG_STDINT_H
20 #if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
42 # if !defined(__STDC_LIMIT_MACROS)
43 # define __STDC_LIMIT_MACROS
44 # define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
46 # if !defined(__STDC_CONSTANT_MACROS)
47 # define __STDC_CONSTANT_MACROS
48 # define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
52 # include_next <stdint.h>
54 # ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
55 # undef __STDC_LIMIT_MACROS
56 # undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
58 # ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
59 # undef __STDC_CONSTANT_MACROS
60 # undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
95 # ifndef __int8_t_defined
96 typedef __INT64_TYPE__ int64_t;
99 # define __int_least64_t int64_t
100 # define __uint_least64_t uint64_t
101 # define __int_least32_t int64_t
102 # define __uint_least32_t uint64_t
103 # define __int_least16_t int64_t
104 # define __uint_least16_t uint64_t
105 # define __int_least8_t int64_t
106 # define __uint_least8_t uint64_t
109 #ifdef __int_least64_t
110 typedef __int_least64_t int_least64_t;
111 typedef __uint_least64_t uint_least64_t;
112 typedef __int_least64_t int_fast64_t;
113 typedef __uint_least64_t uint_fast64_t;
116 #ifdef __INT56_TYPE__
117 typedef __INT56_TYPE__ int56_t;
118 typedef __UINT56_TYPE__ uint56_t;
119 typedef int56_t int_least56_t;
120 typedef uint56_t uint_least56_t;
121 typedef int56_t int_fast56_t;
122 typedef uint56_t uint_fast56_t;
123 # define __int_least32_t int56_t
124 # define __uint_least32_t uint56_t
125 # define __int_least16_t int56_t
126 # define __uint_least16_t uint56_t
127 # define __int_least8_t int56_t
128 # define __uint_least8_t uint56_t
132 #ifdef __INT48_TYPE__
133 typedef __INT48_TYPE__ int48_t;
134 typedef __UINT48_TYPE__ uint48_t;
135 typedef int48_t int_least48_t;
136 typedef uint48_t uint_least48_t;
137 typedef int48_t int_fast48_t;
138 typedef uint48_t uint_fast48_t;
139 # define __int_least32_t int48_t
140 # define __uint_least32_t uint48_t
141 # define __int_least16_t int48_t
142 # define __uint_least16_t uint48_t
143 # define __int_least8_t int48_t
144 # define __uint_least8_t uint48_t
148 #ifdef __INT40_TYPE__
149 typedef __INT40_TYPE__ int40_t;
150 typedef __UINT40_TYPE__ uint40_t;
151 typedef int40_t int_least40_t;
152 typedef uint40_t uint_least40_t;
153 typedef int40_t int_fast40_t;
154 typedef uint40_t uint_fast40_t;
155 # define __int_least32_t int40_t
156 # define __uint_least32_t uint40_t
157 # define __int_least16_t int40_t
158 # define __uint_least16_t uint40_t
159 # define __int_least8_t int40_t
160 # define __uint_least8_t uint40_t
164 #ifdef __INT32_TYPE__
166 # ifndef __int8_t_defined
167 typedef __INT32_TYPE__
int32_t;
170 # ifndef __uint32_t_defined
171 # define __uint32_t_defined
175 # define __int_least32_t int32_t
176 # define __uint_least32_t uint32_t
177 # define __int_least16_t int32_t
178 # define __uint_least16_t uint32_t
179 # define __int_least8_t int32_t
180 # define __uint_least8_t uint32_t
183 #ifdef __int_least32_t
184 typedef __int_least32_t int_least32_t;
185 typedef __uint_least32_t uint_least32_t;
186 typedef __int_least32_t int_fast32_t;
187 typedef __uint_least32_t uint_fast32_t;
190 #ifdef __INT24_TYPE__
191 typedef __INT24_TYPE__ int24_t;
192 typedef __UINT24_TYPE__ uint24_t;
193 typedef int24_t int_least24_t;
194 typedef uint24_t uint_least24_t;
195 typedef int24_t int_fast24_t;
196 typedef uint24_t uint_fast24_t;
197 # define __int_least16_t int24_t
198 # define __uint_least16_t uint24_t
199 # define __int_least8_t int24_t
200 # define __uint_least8_t uint24_t
203 #ifdef __INT16_TYPE__
204 #ifndef __int8_t_defined
205 typedef __INT16_TYPE__
int16_t;
208 # define __int_least16_t int16_t
209 # define __uint_least16_t uint16_t
210 # define __int_least8_t int16_t
211 # define __uint_least8_t uint16_t
214 #ifdef __int_least16_t
215 typedef __int_least16_t int_least16_t;
216 typedef __uint_least16_t uint_least16_t;
217 typedef __int_least16_t int_fast16_t;
218 typedef __uint_least16_t uint_fast16_t;
223 #ifndef __int8_t_defined
224 typedef __INT8_TYPE__
int8_t;
226 typedef __UINT8_TYPE__
uint8_t;
227 # define __int_least8_t int8_t
228 # define __uint_least8_t uint8_t
231 #ifdef __int_least8_t
232 typedef __int_least8_t int_least8_t;
233 typedef __uint_least8_t uint_least8_t;
234 typedef __int_least8_t int_fast8_t;
235 typedef __uint_least8_t uint_fast8_t;
239 #ifndef __int8_t_defined
240 # define __int8_t_defined
245 #define __stdint_join3(a,b,c) a ## b ## c
248 #ifndef __intptr_t_defined
250 #define __intptr_t_defined
282 #define __int_c_join(a, b) a ## b
283 #define __int_c(v, suffix) __int_c_join(v, suffix)
284 #define __uint_c(v, suffix) __int_c_join(v##U, suffix)
287 #ifdef __INT64_TYPE__
288 # ifdef __INT64_C_SUFFIX__
289 # define __int64_c_suffix __INT64_C_SUFFIX__
290 # define __int32_c_suffix __INT64_C_SUFFIX__
291 # define __int16_c_suffix __INT64_C_SUFFIX__
292 # define __int8_c_suffix __INT64_C_SUFFIX__
294 # undef __int64_c_suffix
295 # undef __int32_c_suffix
296 # undef __int16_c_suffix
297 # undef __int8_c_suffix
301 #ifdef __int_least64_t
302 # ifdef __int64_c_suffix
303 # define INT64_C(v) __int_c(v, __int64_c_suffix)
304 # define UINT64_C(v) __uint_c(v, __int64_c_suffix)
306 # define INT64_C(v) v
307 # define UINT64_C(v) v ## U
312 #ifdef __INT56_TYPE__
313 # ifdef __INT56_C_SUFFIX__
314 # define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
315 # define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
316 # define __int32_c_suffix __INT56_C_SUFFIX__
317 # define __int16_c_suffix __INT56_C_SUFFIX__
318 # define __int8_c_suffix __INT56_C_SUFFIX__
320 # define INT56_C(v) v
321 # define UINT56_C(v) v ## U
322 # undef __int32_c_suffix
323 # undef __int16_c_suffix
324 # undef __int8_c_suffix
329 #ifdef __INT48_TYPE__
330 # ifdef __INT48_C_SUFFIX__
331 # define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
332 # define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
333 # define __int32_c_suffix __INT48_C_SUFFIX__
334 # define __int16_c_suffix __INT48_C_SUFFIX__
335 # define __int8_c_suffix __INT48_C_SUFFIX__
337 # define INT48_C(v) v
338 # define UINT48_C(v) v ## U
339 # undef __int32_c_suffix
340 # undef __int16_c_suffix
341 # undef __int8_c_suffix
346 #ifdef __INT40_TYPE__
347 # ifdef __INT40_C_SUFFIX__
348 # define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
349 # define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
350 # define __int32_c_suffix __INT40_C_SUFFIX__
351 # define __int16_c_suffix __INT40_C_SUFFIX__
352 # define __int8_c_suffix __INT40_C_SUFFIX__
354 # define INT40_C(v) v
355 # define UINT40_C(v) v ## U
356 # undef __int32_c_suffix
357 # undef __int16_c_suffix
358 # undef __int8_c_suffix
363 #ifdef __INT32_TYPE__
364 # ifdef __INT32_C_SUFFIX__
365 # define __int32_c_suffix __INT32_C_SUFFIX__
366 # define __int16_c_suffix __INT32_C_SUFFIX__
367 # define __int8_c_suffix __INT32_C_SUFFIX__
369 # undef __int32_c_suffix
370 # undef __int16_c_suffix
371 # undef __int8_c_suffix
375 #ifdef __int_least32_t
376 # ifdef __int32_c_suffix
377 # define INT32_C(v) __int_c(v, __int32_c_suffix)
378 # define UINT32_C(v) __uint_c(v, __int32_c_suffix)
380 # define INT32_C(v) v
381 # define UINT32_C(v) v ## U
386 #ifdef __INT24_TYPE__
387 # ifdef __INT24_C_SUFFIX__
388 # define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
389 # define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
390 # define __int16_c_suffix __INT24_C_SUFFIX__
391 # define __int8_c_suffix __INT24_C_SUFFIX__
393 # define INT24_C(v) v
394 # define UINT24_C(v) v ## U
395 # undef __int16_c_suffix
396 # undef __int8_c_suffix
401 #ifdef __INT16_TYPE__
402 # ifdef __INT16_C_SUFFIX__
403 # define __int16_c_suffix __INT16_C_SUFFIX__
404 # define __int8_c_suffix __INT16_C_SUFFIX__
406 # undef __int16_c_suffix
407 # undef __int8_c_suffix
411 #ifdef __int_least16_t
412 # ifdef __int16_c_suffix
413 # define INT16_C(v) __int_c(v, __int16_c_suffix)
414 # define UINT16_C(v) __uint_c(v, __int16_c_suffix)
416 # define INT16_C(v) v
417 # define UINT16_C(v) v ## U
423 # ifdef __INT8_C_SUFFIX__
424 # define __int8_c_suffix __INT8_C_SUFFIX__
426 # undef __int8_c_suffix
430 #ifdef __int_least8_t
431 # ifdef __int8_c_suffix
432 # define INT8_C(v) __int_c(v, __int8_c_suffix)
433 # define UINT8_C(v) __uint_c(v, __int8_c_suffix)
436 # define UINT8_C(v) v ## U
460 #ifdef __INT64_TYPE__
461 # define INT64_MAX INT64_C( 9223372036854775807)
462 # define INT64_MIN (-INT64_C( 9223372036854775807)-1)
463 # define UINT64_MAX UINT64_C(18446744073709551615)
464 # define __INT_LEAST64_MIN INT64_MIN
465 # define __INT_LEAST64_MAX INT64_MAX
466 # define __UINT_LEAST64_MAX UINT64_MAX
467 # define __INT_LEAST32_MIN INT64_MIN
468 # define __INT_LEAST32_MAX INT64_MAX
469 # define __UINT_LEAST32_MAX UINT64_MAX
470 # define __INT_LEAST16_MIN INT64_MIN
471 # define __INT_LEAST16_MAX INT64_MAX
472 # define __UINT_LEAST16_MAX UINT64_MAX
473 # define __INT_LEAST8_MIN INT64_MIN
474 # define __INT_LEAST8_MAX INT64_MAX
475 # define __UINT_LEAST8_MAX UINT64_MAX
478 #ifdef __INT_LEAST64_MIN
479 # define INT_LEAST64_MIN __INT_LEAST64_MIN
480 # define INT_LEAST64_MAX __INT_LEAST64_MAX
481 # define UINT_LEAST64_MAX __UINT_LEAST64_MAX
482 # define INT_FAST64_MIN __INT_LEAST64_MIN
483 # define INT_FAST64_MAX __INT_LEAST64_MAX
484 # define UINT_FAST64_MAX __UINT_LEAST64_MAX
488 #ifdef __INT56_TYPE__
489 # define INT56_MAX INT56_C(36028797018963967)
490 # define INT56_MIN (-INT56_C(36028797018963967)-1)
491 # define UINT56_MAX UINT56_C(72057594037927935)
492 # define INT_LEAST56_MIN INT56_MIN
493 # define INT_LEAST56_MAX INT56_MAX
494 # define UINT_LEAST56_MAX UINT56_MAX
495 # define INT_FAST56_MIN INT56_MIN
496 # define INT_FAST56_MAX INT56_MAX
497 # define UINT_FAST56_MAX UINT56_MAX
498 # define __INT_LEAST32_MIN INT56_MIN
499 # define __INT_LEAST32_MAX INT56_MAX
500 # define __UINT_LEAST32_MAX UINT56_MAX
501 # define __INT_LEAST16_MIN INT56_MIN
502 # define __INT_LEAST16_MAX INT56_MAX
503 # define __UINT_LEAST16_MAX UINT56_MAX
504 # define __INT_LEAST8_MIN INT56_MIN
505 # define __INT_LEAST8_MAX INT56_MAX
506 # define __UINT_LEAST8_MAX UINT56_MAX
510 #ifdef __INT48_TYPE__
511 # define INT48_MAX INT48_C(140737488355327)
512 # define INT48_MIN (-INT48_C(140737488355327)-1)
513 # define UINT48_MAX UINT48_C(281474976710655)
514 # define INT_LEAST48_MIN INT48_MIN
515 # define INT_LEAST48_MAX INT48_MAX
516 # define UINT_LEAST48_MAX UINT48_MAX
517 # define INT_FAST48_MIN INT48_MIN
518 # define INT_FAST48_MAX INT48_MAX
519 # define UINT_FAST48_MAX UINT48_MAX
520 # define __INT_LEAST32_MIN INT48_MIN
521 # define __INT_LEAST32_MAX INT48_MAX
522 # define __UINT_LEAST32_MAX UINT48_MAX
523 # define __INT_LEAST16_MIN INT48_MIN
524 # define __INT_LEAST16_MAX INT48_MAX
525 # define __UINT_LEAST16_MAX UINT48_MAX
526 # define __INT_LEAST8_MIN INT48_MIN
527 # define __INT_LEAST8_MAX INT48_MAX
528 # define __UINT_LEAST8_MAX UINT48_MAX
532 #ifdef __INT40_TYPE__
533 # define INT40_MAX INT40_C(549755813887)
534 # define INT40_MIN (-INT40_C(549755813887)-1)
535 # define UINT40_MAX UINT40_C(1099511627775)
536 # define INT_LEAST40_MIN INT40_MIN
537 # define INT_LEAST40_MAX INT40_MAX
538 # define UINT_LEAST40_MAX UINT40_MAX
539 # define INT_FAST40_MIN INT40_MIN
540 # define INT_FAST40_MAX INT40_MAX
541 # define UINT_FAST40_MAX UINT40_MAX
542 # define __INT_LEAST32_MIN INT40_MIN
543 # define __INT_LEAST32_MAX INT40_MAX
544 # define __UINT_LEAST32_MAX UINT40_MAX
545 # define __INT_LEAST16_MIN INT40_MIN
546 # define __INT_LEAST16_MAX INT40_MAX
547 # define __UINT_LEAST16_MAX UINT40_MAX
548 # define __INT_LEAST8_MIN INT40_MIN
549 # define __INT_LEAST8_MAX INT40_MAX
550 # define __UINT_LEAST8_MAX UINT40_MAX
554 #ifdef __INT32_TYPE__
555 # define INT32_MAX INT32_C(2147483647)
556 # define INT32_MIN (-INT32_C(2147483647)-1)
557 # define UINT32_MAX UINT32_C(4294967295)
558 # define __INT_LEAST32_MIN INT32_MIN
559 # define __INT_LEAST32_MAX INT32_MAX
560 # define __UINT_LEAST32_MAX UINT32_MAX
561 # define __INT_LEAST16_MIN INT32_MIN
562 # define __INT_LEAST16_MAX INT32_MAX
563 # define __UINT_LEAST16_MAX UINT32_MAX
564 # define __INT_LEAST8_MIN INT32_MIN
565 # define __INT_LEAST8_MAX INT32_MAX
566 # define __UINT_LEAST8_MAX UINT32_MAX
569 #ifdef __INT_LEAST32_MIN
570 # define INT_LEAST32_MIN __INT_LEAST32_MIN
571 # define INT_LEAST32_MAX __INT_LEAST32_MAX
572 # define UINT_LEAST32_MAX __UINT_LEAST32_MAX
573 # define INT_FAST32_MIN __INT_LEAST32_MIN
574 # define INT_FAST32_MAX __INT_LEAST32_MAX
575 # define UINT_FAST32_MAX __UINT_LEAST32_MAX
579 #ifdef __INT24_TYPE__
580 # define INT24_MAX INT24_C(8388607)
581 # define INT24_MIN (-INT24_C(8388607)-1)
582 # define UINT24_MAX UINT24_C(16777215)
583 # define INT_LEAST24_MIN INT24_MIN
584 # define INT_LEAST24_MAX INT24_MAX
585 # define UINT_LEAST24_MAX UINT24_MAX
586 # define INT_FAST24_MIN INT24_MIN
587 # define INT_FAST24_MAX INT24_MAX
588 # define UINT_FAST24_MAX UINT24_MAX
589 # define __INT_LEAST16_MIN INT24_MIN
590 # define __INT_LEAST16_MAX INT24_MAX
591 # define __UINT_LEAST16_MAX UINT24_MAX
592 # define __INT_LEAST8_MIN INT24_MIN
593 # define __INT_LEAST8_MAX INT24_MAX
594 # define __UINT_LEAST8_MAX UINT24_MAX
598 #ifdef __INT16_TYPE__
599 #define INT16_MAX INT16_C(32767)
600 #define INT16_MIN (-INT16_C(32767)-1)
601 #define UINT16_MAX UINT16_C(65535)
602 # define __INT_LEAST16_MIN INT16_MIN
603 # define __INT_LEAST16_MAX INT16_MAX
604 # define __UINT_LEAST16_MAX UINT16_MAX
605 # define __INT_LEAST8_MIN INT16_MIN
606 # define __INT_LEAST8_MAX INT16_MAX
607 # define __UINT_LEAST8_MAX UINT16_MAX
610 #ifdef __INT_LEAST16_MIN
611 # define INT_LEAST16_MIN __INT_LEAST16_MIN
612 # define INT_LEAST16_MAX __INT_LEAST16_MAX
613 # define UINT_LEAST16_MAX __UINT_LEAST16_MAX
614 # define INT_FAST16_MIN __INT_LEAST16_MIN
615 # define INT_FAST16_MAX __INT_LEAST16_MAX
616 # define UINT_FAST16_MAX __UINT_LEAST16_MAX
621 # define INT8_MAX INT8_C(127)
622 # define INT8_MIN (-INT8_C(127)-1)
623 # define UINT8_MAX UINT8_C(255)
624 # define __INT_LEAST8_MIN INT8_MIN
625 # define __INT_LEAST8_MAX INT8_MAX
626 # define __UINT_LEAST8_MAX UINT8_MAX
629 #ifdef __INT_LEAST8_MIN
630 # define INT_LEAST8_MIN __INT_LEAST8_MIN
631 # define INT_LEAST8_MAX __INT_LEAST8_MAX
632 # define UINT_LEAST8_MAX __UINT_LEAST8_MAX
633 # define INT_FAST8_MIN __INT_LEAST8_MIN
634 # define INT_FAST8_MAX __INT_LEAST8_MAX
635 # define UINT_FAST8_MAX __UINT_LEAST8_MAX
639 #define __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
640 #define __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
641 #define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
642 #define __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
643 #define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
648 #define INTPTR_MIN (-__INTPTR_MAX__-1)
649 #define INTPTR_MAX __INTPTR_MAX__
650 #define UINTPTR_MAX __UINTPTR_MAX__
651 #define PTRDIFF_MIN (-__PTRDIFF_MAX__-1)
652 #define PTRDIFF_MAX __PTRDIFF_MAX__
653 #define SIZE_MAX __SIZE_MAX__
657 #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
658 #define RSIZE_MAX (SIZE_MAX >> 1)
662 #define INTMAX_MIN (-__INTMAX_MAX__-1)
663 #define INTMAX_MAX __INTMAX_MAX__
664 #define UINTMAX_MAX __UINTMAX_MAX__
667 #define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
668 #define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
669 #ifdef __WINT_UNSIGNED__
670 # define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
671 # define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
673 # define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
674 # define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
678 # define WCHAR_MAX __WCHAR_MAX__
681 # if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
682 # define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
684 # define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
689 #define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
690 #define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
static __inline__ uint32_t
static __inline__ uint64_t
static __inline__ int32_t
static __inline__ uint8_t
static __inline__ int16_t
static __inline__ uint16_t
__UINTPTR_TYPE__ uintptr_t
__UINTMAX_TYPE__ uintmax_t