Warning: This file is not a C or C++ file. It does not have highlighting.

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// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
11// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
12// case the header guard macro is defined.
13#if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__)
14#define __CLANG_STDINT_H
15#endif
16
17/* If we're hosted, fall back to the system's stdint.h, which might have
18 * additional definitions.
19 */
20#if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
21
22// C99 7.18.3 Limits of other integer types
23//
24// Footnote 219, 220: C++ implementations should define these macros only when
25// __STDC_LIMIT_MACROS is defined before <stdint.h> is included.
26//
27// Footnote 222: C++ implementations should define these macros only when
28// __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
29//
30// C++11 [cstdint.syn]p2:
31//
32// The macros defined by <cstdint> are provided unconditionally. In particular,
33// the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in
34// footnotes 219, 220, and 222 in the C standard) play no role in C++.
35//
36// C11 removed the problematic footnotes.
37//
38// Work around this inconsistency by always defining those macros in C++ mode,
39// so that a C library implementation which follows the C99 standard can be
40// used in C++.
41# ifdef __cplusplus
42# if !defined(__STDC_LIMIT_MACROS)
43# define __STDC_LIMIT_MACROS
44# define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
45# endif
46# if !defined(__STDC_CONSTANT_MACROS)
47# define __STDC_CONSTANT_MACROS
48# define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
49# endif
50# endif
51
52# include_next <stdint.h>
53
54# ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
55# undef __STDC_LIMIT_MACROS
56# undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
57# endif
58# ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
59# undef __STDC_CONSTANT_MACROS
60# undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
61# endif
62
63#else
64
65/* C99 7.18.1.1 Exact-width integer types.
66 * C99 7.18.1.2 Minimum-width integer types.
67 * C99 7.18.1.3 Fastest minimum-width integer types.
68 *
69 * The standard requires that exact-width type be defined for 8-, 16-, 32-, and
70 * 64-bit types if they are implemented. Other exact width types are optional.
71 * This implementation defines an exact-width types for every integer width
72 * that is represented in the standard integer types.
73 *
74 * The standard also requires minimum-width types be defined for 8-, 16-, 32-,
75 * and 64-bit widths regardless of whether there are corresponding exact-width
76 * types.
77 *
78 * To accommodate targets that are missing types that are exactly 8, 16, 32, or
79 * 64 bits wide, this implementation takes an approach of cascading
80 * redefinitions, redefining __int_leastN_t to successively smaller exact-width
81 * types. It is therefore important that the types are defined in order of
82 * descending widths.
83 *
84 * We currently assume that the minimum-width types and the fastest
85 * minimum-width types are the same. This is allowed by the standard, but is
86 * suboptimal.
87 *
88 * In violation of the standard, some targets do not implement a type that is
89 * wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit).
90 * To accommodate these targets, a required minimum-width type is only
91 * defined if there exists an exact-width type of equal or greater width.
92 */
93
94#ifdef __INT64_TYPE__
95# ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/
96typedef __INT64_TYPE__ int64_t;
97# endif /* __int8_t_defined */
98typedef __UINT64_TYPE__ uint64_t;
99# undef __int_least64_t
100# define __int_least64_t int64_t
101# undef __uint_least64_t
102# define __uint_least64_t uint64_t
103# undef __int_least32_t
104# define __int_least32_t int64_t
105# undef __uint_least32_t
106# define __uint_least32_t uint64_t
107# undef __int_least16_t
108# define __int_least16_t int64_t
109# undef __uint_least16_t
110# define __uint_least16_t uint64_t
111# undef __int_least8_t
112# define __int_least8_t int64_t
113# undef __uint_least8_t
114# define __uint_least8_t uint64_t
115#endif /* __INT64_TYPE__ */
116
117#ifdef __int_least64_t
118typedef __int_least64_t int_least64_t;
119typedef __uint_least64_t uint_least64_t;
120typedef __int_least64_t int_fast64_t;
121typedef __uint_least64_t uint_fast64_t;
122#endif /* __int_least64_t */
123
124#ifdef __INT56_TYPE__
125typedef __INT56_TYPE__ int56_t;
126typedef __UINT56_TYPE__ uint56_t;
127typedef int56_t int_least56_t;
128typedef uint56_t uint_least56_t;
129typedef int56_t int_fast56_t;
130typedef uint56_t uint_fast56_t;
131# undef __int_least32_t
132# define __int_least32_t int56_t
133# undef __uint_least32_t
134# define __uint_least32_t uint56_t
135# undef __int_least16_t
136# define __int_least16_t int56_t
137# undef __uint_least16_t
138# define __uint_least16_t uint56_t
139# undef __int_least8_t
140# define __int_least8_t int56_t
141# undef __uint_least8_t
142# define __uint_least8_t uint56_t
143#endif /* __INT56_TYPE__ */
144
145
146#ifdef __INT48_TYPE__
147typedef __INT48_TYPE__ int48_t;
148typedef __UINT48_TYPE__ uint48_t;
149typedef int48_t int_least48_t;
150typedef uint48_t uint_least48_t;
151typedef int48_t int_fast48_t;
152typedef uint48_t uint_fast48_t;
153# undef __int_least32_t
154# define __int_least32_t int48_t
155# undef __uint_least32_t
156# define __uint_least32_t uint48_t
157# undef __int_least16_t
158# define __int_least16_t int48_t
159# undef __uint_least16_t
160# define __uint_least16_t uint48_t
161# undef __int_least8_t
162# define __int_least8_t int48_t
163# undef __uint_least8_t
164# define __uint_least8_t uint48_t
165#endif /* __INT48_TYPE__ */
166
167
168#ifdef __INT40_TYPE__
169typedef __INT40_TYPE__ int40_t;
170typedef __UINT40_TYPE__ uint40_t;
171typedef int40_t int_least40_t;
172typedef uint40_t uint_least40_t;
173typedef int40_t int_fast40_t;
174typedef uint40_t uint_fast40_t;
175# undef __int_least32_t
176# define __int_least32_t int40_t
177# undef __uint_least32_t
178# define __uint_least32_t uint40_t
179# undef __int_least16_t
180# define __int_least16_t int40_t
181# undef __uint_least16_t
182# define __uint_least16_t uint40_t
183# undef __int_least8_t
184# define __int_least8_t int40_t
185# undef __uint_least8_t
186# define __uint_least8_t uint40_t
187#endif /* __INT40_TYPE__ */
188
189
190#ifdef __INT32_TYPE__
191
192# ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/
193typedef __INT32_TYPE__ int32_t;
194# endif /* __int8_t_defined */
195
196# ifndef __uint32_t_defined /* more glibc compatibility */
197# define __uint32_t_defined
198typedef __UINT32_TYPE__ uint32_t;
199# endif /* __uint32_t_defined */
200
201# undef __int_least32_t
202# define __int_least32_t int32_t
203# undef __uint_least32_t
204# define __uint_least32_t uint32_t
205# undef __int_least16_t
206# define __int_least16_t int32_t
207# undef __uint_least16_t
208# define __uint_least16_t uint32_t
209# undef __int_least8_t
210# define __int_least8_t int32_t
211# undef __uint_least8_t
212# define __uint_least8_t uint32_t
213#endif /* __INT32_TYPE__ */
214
215#ifdef __int_least32_t
216typedef __int_least32_t int_least32_t;
217typedef __uint_least32_t uint_least32_t;
218typedef __int_least32_t int_fast32_t;
219typedef __uint_least32_t uint_fast32_t;
220#endif /* __int_least32_t */
221
222#ifdef __INT24_TYPE__
223typedef __INT24_TYPE__ int24_t;
224typedef __UINT24_TYPE__ uint24_t;
225typedef int24_t int_least24_t;
226typedef uint24_t uint_least24_t;
227typedef int24_t int_fast24_t;
228typedef uint24_t uint_fast24_t;
229# undef __int_least16_t
230# define __int_least16_t int24_t
231# undef __uint_least16_t
232# define __uint_least16_t uint24_t
233# undef __int_least8_t
234# define __int_least8_t int24_t
235# undef __uint_least8_t
236# define __uint_least8_t uint24_t
237#endif /* __INT24_TYPE__ */
238
239#ifdef __INT16_TYPE__
240#ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/
241typedef __INT16_TYPE__ int16_t;
242#endif /* __int8_t_defined */
243typedef __UINT16_TYPE__ uint16_t;
244# undef __int_least16_t
245# define __int_least16_t int16_t
246# undef __uint_least16_t
247# define __uint_least16_t uint16_t
248# undef __int_least8_t
249# define __int_least8_t int16_t
250# undef __uint_least8_t
251# define __uint_least8_t uint16_t
252#endif /* __INT16_TYPE__ */
253
254#ifdef __int_least16_t
255typedef __int_least16_t int_least16_t;
256typedef __uint_least16_t uint_least16_t;
257typedef __int_least16_t int_fast16_t;
258typedef __uint_least16_t uint_fast16_t;
259#endif /* __int_least16_t */
260
261
262#ifdef __INT8_TYPE__
263#ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/
264typedef __INT8_TYPE__ int8_t;
265#endif /* __int8_t_defined */
266typedef __UINT8_TYPE__ uint8_t;
267# undef __int_least8_t
268# define __int_least8_t int8_t
269# undef __uint_least8_t
270# define __uint_least8_t uint8_t
271#endif /* __INT8_TYPE__ */
272
273#ifdef __int_least8_t
274typedef __int_least8_t int_least8_t;
275typedef __uint_least8_t uint_least8_t;
276typedef __int_least8_t int_fast8_t;
277typedef __uint_least8_t uint_fast8_t;
278#endif /* __int_least8_t */
279
280/* prevent glibc sys/types.h from defining conflicting types */
281#ifndef __int8_t_defined
282# define __int8_t_defined
283#endif /* __int8_t_defined */
284
285/* C99 7.18.1.4 Integer types capable of holding object pointers.
286 */
287#define __stdint_join3(a,b,c) a ## b ## c
288
289#ifndef _INTPTR_T
290#ifndef __intptr_t_defined
291typedef __INTPTR_TYPE__ intptr_t;
292#define __intptr_t_defined
293#define _INTPTR_T
294#endif
295#endif
296
297#ifndef _UINTPTR_T
298typedef __UINTPTR_TYPE__ uintptr_t;
299#define _UINTPTR_T
300#endif
301
302/* C99 7.18.1.5 Greatest-width integer types.
303 */
304typedef __INTMAX_TYPE__ intmax_t;
305typedef __UINTMAX_TYPE__ uintmax_t;
306
307/* C99 7.18.4 Macros for minimum-width integer constants.
308 *
309 * The standard requires that integer constant macros be defined for all the
310 * minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width
311 * types are required, the corresponding integer constant macros are defined
312 * here. This implementation also defines minimum-width types for every other
313 * integer width that the target implements, so corresponding macros are
314 * defined below, too.
315 *
316 * These macros are defined using the same successive-shrinking approach as
317 * the type definitions above. It is likewise important that macros are defined
318 * in order of decending width.
319 *
320 * Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
321 * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
322 */
323
324#define __int_c_join(a, b) a ## b
325#define __int_c(v, suffix) __int_c_join(v, suffix)
326#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
327
328
329#ifdef __INT64_TYPE__
330# undef __int64_c_suffix
331# undef __int32_c_suffix
332# undef __int16_c_suffix
333# undef __int8_c_suffix
334# ifdef __INT64_C_SUFFIX__
335# define __int64_c_suffix __INT64_C_SUFFIX__
336# define __int32_c_suffix __INT64_C_SUFFIX__
337# define __int16_c_suffix __INT64_C_SUFFIX__
338# define __int8_c_suffix __INT64_C_SUFFIX__
339# endif /* __INT64_C_SUFFIX__ */
340#endif /* __INT64_TYPE__ */
341
342#ifdef __int_least64_t
343# ifdef __int64_c_suffix
344# define INT64_C(v) __int_c(v, __int64_c_suffix)
345# define UINT64_C(v) __uint_c(v, __int64_c_suffix)
346# else
347# define INT64_C(v) v
348# define UINT64_C(v) v ## U
349# endif /* __int64_c_suffix */
350#endif /* __int_least64_t */
351
352
353#ifdef __INT56_TYPE__
354# undef __int32_c_suffix
355# undef __int16_c_suffix
356# undef __int8_c_suffix
357# ifdef __INT56_C_SUFFIX__
358# define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
359# define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
360# define __int32_c_suffix __INT56_C_SUFFIX__
361# define __int16_c_suffix __INT56_C_SUFFIX__
362# define __int8_c_suffix __INT56_C_SUFFIX__
363# else
364# define INT56_C(v) v
365# define UINT56_C(v) v ## U
366# endif /* __INT56_C_SUFFIX__ */
367#endif /* __INT56_TYPE__ */
368
369
370#ifdef __INT48_TYPE__
371# undef __int32_c_suffix
372# undef __int16_c_suffix
373# undef __int8_c_suffix
374# ifdef __INT48_C_SUFFIX__
375# define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
376# define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
377# define __int32_c_suffix __INT48_C_SUFFIX__
378# define __int16_c_suffix __INT48_C_SUFFIX__
379# define __int8_c_suffix __INT48_C_SUFFIX__
380# else
381# define INT48_C(v) v
382# define UINT48_C(v) v ## U
383# endif /* __INT48_C_SUFFIX__ */
384#endif /* __INT48_TYPE__ */
385
386
387#ifdef __INT40_TYPE__
388# undef __int32_c_suffix
389# undef __int16_c_suffix
390# undef __int8_c_suffix
391# ifdef __INT40_C_SUFFIX__
392# define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
393# define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
394# define __int32_c_suffix __INT40_C_SUFFIX__
395# define __int16_c_suffix __INT40_C_SUFFIX__
396# define __int8_c_suffix __INT40_C_SUFFIX__
397# else
398# define INT40_C(v) v
399# define UINT40_C(v) v ## U
400# endif /* __INT40_C_SUFFIX__ */
401#endif /* __INT40_TYPE__ */
402
403
404#ifdef __INT32_TYPE__
405# undef __int32_c_suffix
406# undef __int16_c_suffix
407# undef __int8_c_suffix
408# ifdef __INT32_C_SUFFIX__
409# define __int32_c_suffix __INT32_C_SUFFIX__
410# define __int16_c_suffix __INT32_C_SUFFIX__
411# define __int8_c_suffix __INT32_C_SUFFIX__
412# endif /* __INT32_C_SUFFIX__ */
413#endif /* __INT32_TYPE__ */
414
415#ifdef __int_least32_t
416# ifdef __int32_c_suffix
417# define INT32_C(v) __int_c(v, __int32_c_suffix)
418# define UINT32_C(v) __uint_c(v, __int32_c_suffix)
419# else
420# define INT32_C(v) v
421# define UINT32_C(v) v ## U
422# endif /* __int32_c_suffix */
423#endif /* __int_least32_t */
424
425
426#ifdef __INT24_TYPE__
427# undef __int16_c_suffix
428# undef __int8_c_suffix
429# ifdef __INT24_C_SUFFIX__
430# define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
431# define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
432# define __int16_c_suffix __INT24_C_SUFFIX__
433# define __int8_c_suffix __INT24_C_SUFFIX__
434# else
435# define INT24_C(v) v
436# define UINT24_C(v) v ## U
437# endif /* __INT24_C_SUFFIX__ */
438#endif /* __INT24_TYPE__ */
439
440
441#ifdef __INT16_TYPE__
442# undef __int16_c_suffix
443# undef __int8_c_suffix
444# ifdef __INT16_C_SUFFIX__
445# define __int16_c_suffix __INT16_C_SUFFIX__
446# define __int8_c_suffix __INT16_C_SUFFIX__
447# endif /* __INT16_C_SUFFIX__ */
448#endif /* __INT16_TYPE__ */
449
450#ifdef __int_least16_t
451# ifdef __int16_c_suffix
452# define INT16_C(v) __int_c(v, __int16_c_suffix)
453# define UINT16_C(v) __uint_c(v, __int16_c_suffix)
454# else
455# define INT16_C(v) v
456# define UINT16_C(v) v ## U
457# endif /* __int16_c_suffix */
458#endif /* __int_least16_t */
459
460
461#ifdef __INT8_TYPE__
462# undef __int8_c_suffix
463# ifdef __INT8_C_SUFFIX__
464# define __int8_c_suffix __INT8_C_SUFFIX__
465# endif /* __INT8_C_SUFFIX__ */
466#endif /* __INT8_TYPE__ */
467
468#ifdef __int_least8_t
469# ifdef __int8_c_suffix
470# define INT8_C(v) __int_c(v, __int8_c_suffix)
471# define UINT8_C(v) __uint_c(v, __int8_c_suffix)
472# else
473# define INT8_C(v) v
474# define UINT8_C(v) v ## U
475# endif /* __int8_c_suffix */
476#endif /* __int_least8_t */
477
478
479/* C99 7.18.2.1 Limits of exact-width integer types.
480 * C99 7.18.2.2 Limits of minimum-width integer types.
481 * C99 7.18.2.3 Limits of fastest minimum-width integer types.
482 *
483 * The presence of limit macros are completely optional in C99. This
484 * implementation defines limits for all of the types (exact- and
485 * minimum-width) that it defines above, using the limits of the minimum-width
486 * type for any types that do not have exact-width representations.
487 *
488 * As in the type definitions, this section takes an approach of
489 * successive-shrinking to determine which limits to use for the standard (8,
490 * 16, 32, 64) bit widths when they don't have exact representations. It is
491 * therefore important that the definitions be kept in order of decending
492 * widths.
493 *
494 * Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the
495 * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
496 */
497
498#ifdef __INT64_TYPE__
499# define INT64_MAX INT64_C( 9223372036854775807)
500# define INT64_MIN (-INT64_C( 9223372036854775807)-1)
501# define UINT64_MAX UINT64_C(18446744073709551615)
502
503#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
504# define UINT64_WIDTH 64
505# define INT64_WIDTH UINT64_WIDTH
506
507# define __UINT_LEAST64_WIDTH UINT64_WIDTH
508# undef __UINT_LEAST32_WIDTH
509# define __UINT_LEAST32_WIDTH UINT64_WIDTH
510# undef __UINT_LEAST16_WIDTH
511# define __UINT_LEAST16_WIDTH UINT64_WIDTH
512# undef __UINT_LEAST8_MAX
513# define __UINT_LEAST8_MAX UINT64_MAX
514#endif /* __STDC_VERSION__ */
515
516# define __INT_LEAST64_MIN INT64_MIN
517# define __INT_LEAST64_MAX INT64_MAX
518# define __UINT_LEAST64_MAX UINT64_MAX
519# undef __INT_LEAST32_MIN
520# define __INT_LEAST32_MIN INT64_MIN
521# undef __INT_LEAST32_MAX
522# define __INT_LEAST32_MAX INT64_MAX
523# undef __UINT_LEAST32_MAX
524# define __UINT_LEAST32_MAX UINT64_MAX
525# undef __INT_LEAST16_MIN
526# define __INT_LEAST16_MIN INT64_MIN
527# undef __INT_LEAST16_MAX
528# define __INT_LEAST16_MAX INT64_MAX
529# undef __UINT_LEAST16_MAX
530# define __UINT_LEAST16_MAX UINT64_MAX
531# undef __INT_LEAST8_MIN
532# define __INT_LEAST8_MIN INT64_MIN
533# undef __INT_LEAST8_MAX
534# define __INT_LEAST8_MAX INT64_MAX
535# undef __UINT_LEAST8_MAX
536# define __UINT_LEAST8_MAX UINT64_MAX
537#endif /* __INT64_TYPE__ */
538
539#ifdef __INT_LEAST64_MIN
540# define INT_LEAST64_MIN __INT_LEAST64_MIN
541# define INT_LEAST64_MAX __INT_LEAST64_MAX
542# define UINT_LEAST64_MAX __UINT_LEAST64_MAX
543# define INT_FAST64_MIN __INT_LEAST64_MIN
544# define INT_FAST64_MAX __INT_LEAST64_MAX
545# define UINT_FAST64_MAX __UINT_LEAST64_MAX
546
547#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
548# define UINT_LEAST64_WIDTH __UINT_LEAST64_WIDTH
549# define INT_LEAST64_WIDTH UINT_LEAST64_WIDTH
550# define UINT_FAST64_WIDTH __UINT_LEAST64_WIDTH
551# define INT_FAST64_WIDTH UINT_FAST64_WIDTH
552#endif /* __STDC_VERSION__ */
553#endif /* __INT_LEAST64_MIN */
554
555
556#ifdef __INT56_TYPE__
557# define INT56_MAX INT56_C(36028797018963967)
558# define INT56_MIN (-INT56_C(36028797018963967)-1)
559# define UINT56_MAX UINT56_C(72057594037927935)
560# define INT_LEAST56_MIN INT56_MIN
561# define INT_LEAST56_MAX INT56_MAX
562# define UINT_LEAST56_MAX UINT56_MAX
563# define INT_FAST56_MIN INT56_MIN
564# define INT_FAST56_MAX INT56_MAX
565# define UINT_FAST56_MAX UINT56_MAX
566
567# undef __INT_LEAST32_MIN
568# define __INT_LEAST32_MIN INT56_MIN
569# undef __INT_LEAST32_MAX
570# define __INT_LEAST32_MAX INT56_MAX
571# undef __UINT_LEAST32_MAX
572# define __UINT_LEAST32_MAX UINT56_MAX
573# undef __INT_LEAST16_MIN
574# define __INT_LEAST16_MIN INT56_MIN
575# undef __INT_LEAST16_MAX
576# define __INT_LEAST16_MAX INT56_MAX
577# undef __UINT_LEAST16_MAX
578# define __UINT_LEAST16_MAX UINT56_MAX
579# undef __INT_LEAST8_MIN
580# define __INT_LEAST8_MIN INT56_MIN
581# undef __INT_LEAST8_MAX
582# define __INT_LEAST8_MAX INT56_MAX
583# undef __UINT_LEAST8_MAX
584# define __UINT_LEAST8_MAX UINT56_MAX
585
586#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
587# define UINT56_WIDTH 56
588# define INT56_WIDTH UINT56_WIDTH
589# define UINT_LEAST56_WIDTH UINT56_WIDTH
590# define INT_LEAST56_WIDTH UINT_LEAST56_WIDTH
591# define UINT_FAST56_WIDTH UINT56_WIDTH
592# define INT_FAST56_WIDTH UINT_FAST56_WIDTH
593# undef __UINT_LEAST32_WIDTH
594# define __UINT_LEAST32_WIDTH UINT56_WIDTH
595# undef __UINT_LEAST16_WIDTH
596# define __UINT_LEAST16_WIDTH UINT56_WIDTH
597# undef __UINT_LEAST8_WIDTH
598# define __UINT_LEAST8_WIDTH UINT56_WIDTH
599#endif /* __STDC_VERSION__ */
600#endif /* __INT56_TYPE__ */
601
602
603#ifdef __INT48_TYPE__
604# define INT48_MAX INT48_C(140737488355327)
605# define INT48_MIN (-INT48_C(140737488355327)-1)
606# define UINT48_MAX UINT48_C(281474976710655)
607# define INT_LEAST48_MIN INT48_MIN
608# define INT_LEAST48_MAX INT48_MAX
609# define UINT_LEAST48_MAX UINT48_MAX
610# define INT_FAST48_MIN INT48_MIN
611# define INT_FAST48_MAX INT48_MAX
612# define UINT_FAST48_MAX UINT48_MAX
613
614# undef __INT_LEAST32_MIN
615# define __INT_LEAST32_MIN INT48_MIN
616# undef __INT_LEAST32_MAX
617# define __INT_LEAST32_MAX INT48_MAX
618# undef __UINT_LEAST32_MAX
619# define __UINT_LEAST32_MAX UINT48_MAX
620# undef __INT_LEAST16_MIN
621# define __INT_LEAST16_MIN INT48_MIN
622# undef __INT_LEAST16_MAX
623# define __INT_LEAST16_MAX INT48_MAX
624# undef __UINT_LEAST16_MAX
625# define __UINT_LEAST16_MAX UINT48_MAX
626# undef __INT_LEAST8_MIN
627# define __INT_LEAST8_MIN INT48_MIN
628# undef __INT_LEAST8_MAX
629# define __INT_LEAST8_MAX INT48_MAX
630# undef __UINT_LEAST8_MAX
631# define __UINT_LEAST8_MAX UINT48_MAX
632
633#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
634#define UINT48_WIDTH 48
635#define INT48_WIDTH UINT48_WIDTH
636#define UINT_LEAST48_WIDTH UINT48_WIDTH
637#define INT_LEAST48_WIDTH UINT_LEAST48_WIDTH
638#define UINT_FAST48_WIDTH UINT48_WIDTH
639#define INT_FAST48_WIDTH UINT_FAST48_WIDTH
640#undef __UINT_LEAST32_WIDTH
641#define __UINT_LEAST32_WIDTH UINT48_WIDTH
642# undef __UINT_LEAST16_WIDTH
643#define __UINT_LEAST16_WIDTH UINT48_WIDTH
644# undef __UINT_LEAST8_WIDTH
645#define __UINT_LEAST8_WIDTH UINT48_WIDTH
646#endif /* __STDC_VERSION__ */
647#endif /* __INT48_TYPE__ */
648
649
650#ifdef __INT40_TYPE__
651# define INT40_MAX INT40_C(549755813887)
652# define INT40_MIN (-INT40_C(549755813887)-1)
653# define UINT40_MAX UINT40_C(1099511627775)
654# define INT_LEAST40_MIN INT40_MIN
655# define INT_LEAST40_MAX INT40_MAX
656# define UINT_LEAST40_MAX UINT40_MAX
657# define INT_FAST40_MIN INT40_MIN
658# define INT_FAST40_MAX INT40_MAX
659# define UINT_FAST40_MAX UINT40_MAX
660
661# undef __INT_LEAST32_MIN
662# define __INT_LEAST32_MIN INT40_MIN
663# undef __INT_LEAST32_MAX
664# define __INT_LEAST32_MAX INT40_MAX
665# undef __UINT_LEAST32_MAX
666# define __UINT_LEAST32_MAX UINT40_MAX
667# undef __INT_LEAST16_MIN
668# define __INT_LEAST16_MIN INT40_MIN
669# undef __INT_LEAST16_MAX
670# define __INT_LEAST16_MAX INT40_MAX
671# undef __UINT_LEAST16_MAX
672# define __UINT_LEAST16_MAX UINT40_MAX
673# undef __INT_LEAST8_MIN
674# define __INT_LEAST8_MIN INT40_MIN
675# undef __INT_LEAST8_MAX
676# define __INT_LEAST8_MAX INT40_MAX
677# undef __UINT_LEAST8_MAX
678# define __UINT_LEAST8_MAX UINT40_MAX
679
680#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
681# define UINT40_WIDTH 40
682# define INT40_WIDTH UINT40_WIDTH
683# define UINT_LEAST40_WIDTH UINT40_WIDTH
684# define INT_LEAST40_WIDTH UINT_LEAST40_WIDTH
685# define UINT_FAST40_WIDTH UINT40_WIDTH
686# define INT_FAST40_WIDTH UINT_FAST40_WIDTH
687# undef __UINT_LEAST32_WIDTH
688# define __UINT_LEAST32_WIDTH UINT40_WIDTH
689# undef __UINT_LEAST16_WIDTH
690# define __UINT_LEAST16_WIDTH UINT40_WIDTH
691# undef __UINT_LEAST8_WIDTH
692# define __UINT_LEAST8_WIDTH UINT40_WIDTH
693#endif /* __STDC_VERSION__ */
694#endif /* __INT40_TYPE__ */
695
696
697#ifdef __INT32_TYPE__
698# define INT32_MAX INT32_C(2147483647)
699# define INT32_MIN (-INT32_C(2147483647)-1)
700# define UINT32_MAX UINT32_C(4294967295)
701
702# undef __INT_LEAST32_MIN
703# define __INT_LEAST32_MIN INT32_MIN
704# undef __INT_LEAST32_MAX
705# define __INT_LEAST32_MAX INT32_MAX
706# undef __UINT_LEAST32_MAX
707# define __UINT_LEAST32_MAX UINT32_MAX
708# undef __INT_LEAST16_MIN
709# define __INT_LEAST16_MIN INT32_MIN
710# undef __INT_LEAST16_MAX
711# define __INT_LEAST16_MAX INT32_MAX
712# undef __UINT_LEAST16_MAX
713# define __UINT_LEAST16_MAX UINT32_MAX
714# undef __INT_LEAST8_MIN
715# define __INT_LEAST8_MIN INT32_MIN
716# undef __INT_LEAST8_MAX
717# define __INT_LEAST8_MAX INT32_MAX
718# undef __UINT_LEAST8_MAX
719# define __UINT_LEAST8_MAX UINT32_MAX
720
721#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
722# define UINT32_WIDTH 32
723# define INT32_WIDTH UINT32_WIDTH
724# undef __UINT_LEAST32_WIDTH
725# define __UINT_LEAST32_WIDTH UINT32_WIDTH
726# undef __UINT_LEAST16_WIDTH
727# define __UINT_LEAST16_WIDTH UINT32_WIDTH
728# undef __UINT_LEAST8_WIDTH
729# define __UINT_LEAST8_WIDTH UINT32_WIDTH
730#endif /* __STDC_VERSION__ */
731#endif /* __INT32_TYPE__ */
732
733#ifdef __INT_LEAST32_MIN
734# define INT_LEAST32_MIN __INT_LEAST32_MIN
735# define INT_LEAST32_MAX __INT_LEAST32_MAX
736# define UINT_LEAST32_MAX __UINT_LEAST32_MAX
737# define INT_FAST32_MIN __INT_LEAST32_MIN
738# define INT_FAST32_MAX __INT_LEAST32_MAX
739# define UINT_FAST32_MAX __UINT_LEAST32_MAX
740
741#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
742# define UINT_LEAST32_WIDTH __UINT_LEAST32_WIDTH
743# define INT_LEAST32_WIDTH UINT_LEAST32_WIDTH
744# define UINT_FAST32_WIDTH __UINT_LEAST32_WIDTH
745# define INT_FAST32_WIDTH UINT_FAST32_WIDTH
746#endif /* __STDC_VERSION__ */
747#endif /* __INT_LEAST32_MIN */
748
749
750#ifdef __INT24_TYPE__
751# define INT24_MAX INT24_C(8388607)
752# define INT24_MIN (-INT24_C(8388607)-1)
753# define UINT24_MAX UINT24_C(16777215)
754# define INT_LEAST24_MIN INT24_MIN
755# define INT_LEAST24_MAX INT24_MAX
756# define UINT_LEAST24_MAX UINT24_MAX
757# define INT_FAST24_MIN INT24_MIN
758# define INT_FAST24_MAX INT24_MAX
759# define UINT_FAST24_MAX UINT24_MAX
760
761# undef __INT_LEAST16_MIN
762# define __INT_LEAST16_MIN INT24_MIN
763# undef __INT_LEAST16_MAX
764# define __INT_LEAST16_MAX INT24_MAX
765# undef __UINT_LEAST16_MAX
766# define __UINT_LEAST16_MAX UINT24_MAX
767# undef __INT_LEAST8_MIN
768# define __INT_LEAST8_MIN INT24_MIN
769# undef __INT_LEAST8_MAX
770# define __INT_LEAST8_MAX INT24_MAX
771# undef __UINT_LEAST8_MAX
772# define __UINT_LEAST8_MAX UINT24_MAX
773
774#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
775# define UINT24_WIDTH 24
776# define INT24_WIDTH UINT24_WIDTH
777# define UINT_LEAST24_WIDTH UINT24_WIDTH
778# define INT_LEAST24_WIDTH UINT_LEAST24_WIDTH
779# define UINT_FAST24_WIDTH UINT24_WIDTH
780# define INT_FAST24_WIDTH UINT_FAST24_WIDTH
781# undef __UINT_LEAST16_WIDTH
782# define __UINT_LEAST16_WIDTH UINT24_WIDTH
783# undef __UINT_LEAST8_WIDTH
784# define __UINT_LEAST8_WIDTH UINT24_WIDTH
785#endif /* __STDC_VERSION__ */
786#endif /* __INT24_TYPE__ */
787
788
789#ifdef __INT16_TYPE__
790#define INT16_MAX INT16_C(32767)
791#define INT16_MIN (-INT16_C(32767)-1)
792#define UINT16_MAX UINT16_C(65535)
793
794# undef __INT_LEAST16_MIN
795# define __INT_LEAST16_MIN INT16_MIN
796# undef __INT_LEAST16_MAX
797# define __INT_LEAST16_MAX INT16_MAX
798# undef __UINT_LEAST16_MAX
799# define __UINT_LEAST16_MAX UINT16_MAX
800# undef __INT_LEAST8_MIN
801# define __INT_LEAST8_MIN INT16_MIN
802# undef __INT_LEAST8_MAX
803# define __INT_LEAST8_MAX INT16_MAX
804# undef __UINT_LEAST8_MAX
805# define __UINT_LEAST8_MAX UINT16_MAX
806
807#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
808# define UINT16_WIDTH 16
809# define INT16_WIDTH UINT16_WIDTH
810# undef __UINT_LEAST16_WIDTH
811# define __UINT_LEAST16_WIDTH UINT16_WIDTH
812# undef __UINT_LEAST8_WIDTH
813# define __UINT_LEAST8_WIDTH UINT16_WIDTH
814#endif /* __STDC_VERSION__ */
815#endif /* __INT16_TYPE__ */
816
817#ifdef __INT_LEAST16_MIN
818# define INT_LEAST16_MIN __INT_LEAST16_MIN
819# define INT_LEAST16_MAX __INT_LEAST16_MAX
820# define UINT_LEAST16_MAX __UINT_LEAST16_MAX
821# define INT_FAST16_MIN __INT_LEAST16_MIN
822# define INT_FAST16_MAX __INT_LEAST16_MAX
823# define UINT_FAST16_MAX __UINT_LEAST16_MAX
824
825#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
826# define UINT_LEAST16_WIDTH __UINT_LEAST16_WIDTH
827# define INT_LEAST16_WIDTH UINT_LEAST16_WIDTH
828# define UINT_FAST16_WIDTH __UINT_LEAST16_WIDTH
829# define INT_FAST16_WIDTH UINT_FAST16_WIDTH
830#endif /* __STDC_VERSION__ */
831#endif /* __INT_LEAST16_MIN */
832
833
834#ifdef __INT8_TYPE__
835# define INT8_MAX INT8_C(127)
836# define INT8_MIN (-INT8_C(127)-1)
837# define UINT8_MAX UINT8_C(255)
838
839# undef __INT_LEAST8_MIN
840# define __INT_LEAST8_MIN INT8_MIN
841# undef __INT_LEAST8_MAX
842# define __INT_LEAST8_MAX INT8_MAX
843# undef __UINT_LEAST8_MAX
844# define __UINT_LEAST8_MAX UINT8_MAX
845
846#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
847# define UINT8_WIDTH 8
848# define INT8_WIDTH UINT8_WIDTH
849# undef __UINT_LEAST8_WIDTH
850# define __UINT_LEAST8_WIDTH UINT8_WIDTH
851#endif /* __STDC_VERSION__ */
852#endif /* __INT8_TYPE__ */
853
854#ifdef __INT_LEAST8_MIN
855# define INT_LEAST8_MIN __INT_LEAST8_MIN
856# define INT_LEAST8_MAX __INT_LEAST8_MAX
857# define UINT_LEAST8_MAX __UINT_LEAST8_MAX
858# define INT_FAST8_MIN __INT_LEAST8_MIN
859# define INT_FAST8_MAX __INT_LEAST8_MAX
860# define UINT_FAST8_MAX __UINT_LEAST8_MAX
861
862#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
863# define UINT_LEAST8_WIDTH __UINT_LEAST8_WIDTH
864# define INT_LEAST8_WIDTH UINT_LEAST8_WIDTH
865# define UINT_FAST8_WIDTH __UINT_LEAST8_WIDTH
866# define INT_FAST8_WIDTH UINT_FAST8_WIDTH
867#endif /* __STDC_VERSION__ */
868#endif /* __INT_LEAST8_MIN */
869
870/* Some utility macros */
871#define __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
872#define __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
873#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
874#define __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
875#define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
876
877/* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
878/* C99 7.18.3 Limits of other integer types. */
879
880#define INTPTR_MIN (-__INTPTR_MAX__-1)
881#define INTPTR_MAX __INTPTR_MAX__
882#define UINTPTR_MAX __UINTPTR_MAX__
883#define PTRDIFF_MIN (-__PTRDIFF_MAX__-1)
884#define PTRDIFF_MAX __PTRDIFF_MAX__
885#define SIZE_MAX __SIZE_MAX__
886
887/* C23 7.22.2.4 Width of integer types capable of holding object pointers. */
888#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
889/* NB: The C standard requires that these be the same value, but the compiler
890 exposes separate internal width macros. */
891#define INTPTR_WIDTH __INTPTR_WIDTH__
892#define UINTPTR_WIDTH __UINTPTR_WIDTH__
893#endif
894
895/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
896 * is enabled. */
897#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
898#define RSIZE_MAX (SIZE_MAX >> 1)
899#endif
900
901/* C99 7.18.2.5 Limits of greatest-width integer types. */
902#define INTMAX_MIN (-__INTMAX_MAX__-1)
903#define INTMAX_MAX __INTMAX_MAX__
904#define UINTMAX_MAX __UINTMAX_MAX__
905
906/* C23 7.22.2.5 Width of greatest-width integer types. */
907#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
908/* NB: The C standard requires that these be the same value, but the compiler
909 exposes separate internal width macros. */
910#define INTMAX_WIDTH __INTMAX_WIDTH__
911#define UINTMAX_WIDTH __UINTMAX_WIDTH__
912#endif
913
914/* C99 7.18.3 Limits of other integer types. */
915#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
916#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
917#ifdef __WINT_UNSIGNED__
918# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
919# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
920#else
921# define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
922# define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
923#endif
924
925#ifndef WCHAR_MAX
926# define WCHAR_MAX __WCHAR_MAX__
927#endif
928#ifndef WCHAR_MIN
929# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
930# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
931# else
932# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
933# endif
934#endif
935
936/* 7.18.4.2 Macros for greatest-width integer constants. */
937#define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
938#define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
939
940/* C23 7.22.3.x Width of other integer types. */
941#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
942#define PTRDIFF_WIDTH __PTRDIFF_WIDTH__
943#define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__
944#define SIZE_WIDTH __SIZE_WIDTH__
945#define WCHAR_WIDTH __WCHAR_WIDTH__
946#define WINT_WIDTH __WINT_WIDTH__
947#endif
948
949#endif /* __STDC_HOSTED__ */
950#endif /* __CLANG_STDINT_H */
951

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of clang/lib/Headers/stdint.h