blob: dd8ebbab1cf0117c40320cf1810cca0b63d17f4e [file] [log] [blame]
Imre Kisf55f2aa2024-05-28 15:55:19 +02001/*
2 * Copyright (c) 2012-2017 Roberto E. Vargas Caballero
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6/*
Imre Kis650ae322024-05-28 15:59:48 +02007 * Portions copyright (c) 2018-2024, Arm Limited and Contributors.
Imre Kisf55f2aa2024-05-28 15:55:19 +02008 * All rights reserved.
9 */
10
11#ifndef STDINT_H
12#define STDINT_H
13
14#include <limits.h>
15#include <stdint_.h>
16
17#define INT8_MAX CHAR_MAX
18#define INT8_MIN CHAR_MIN
19#define UINT8_MAX UCHAR_MAX
20
21#define INT16_MAX SHRT_MAX
22#define INT16_MIN SHRT_MIN
23#define UINT16_MAX USHRT_MAX
24
25#define INT32_MAX INT_MAX
26#define INT32_MIN INT_MIN
27#define UINT32_MAX UINT_MAX
28
29#define INT_LEAST8_MIN INT8_MIN
30#define INT_LEAST8_MAX INT8_MAX
31#define UINT_LEAST8_MAX UINT8_MAX
32
33#define INT_LEAST16_MIN INT16_MIN
34#define INT_LEAST16_MAX INT16_MAX
35#define UINT_LEAST16_MAX UINT16_MAX
36
37#define INT_LEAST32_MIN INT32_MIN
38#define INT_LEAST32_MAX INT32_MAX
39#define UINT_LEAST32_MAX UINT32_MAX
40
41#define INT_LEAST64_MIN INT64_MIN
42#define INT_LEAST64_MAX INT64_MAX
43#define UINT_LEAST64_MAX UINT64_MAX
44
45#define INT_FAST8_MIN INT32_MIN
46#define INT_FAST8_MAX INT32_MAX
47#define UINT_FAST8_MAX UINT32_MAX
48
49#define INT_FAST16_MIN INT32_MIN
50#define INT_FAST16_MAX INT32_MAX
51#define UINT_FAST16_MAX UINT32_MAX
52
53#define INT_FAST32_MIN INT32_MIN
54#define INT_FAST32_MAX INT32_MAX
55#define UINT_FAST32_MAX UINT32_MAX
56
57#define INT_FAST64_MIN INT64_MIN
58#define INT_FAST64_MAX INT64_MAX
59#define UINT_FAST64_MAX UINT64_MAX
60
61#define INTPTR_MIN LONG_MIN
62#define INTPTR_MAX LONG_MAX
63#define UINTPTR_MAX ULONG_MAX
64
65#define INTMAX_MIN LLONG_MIN
66#define INTMAX_MAX LLONG_MAX
67#define UINTMAX_MAX ULLONG_MAX
68
69#define PTRDIFF_MIN LONG_MIN
70#define PTRDIFF_MAX LONG_MAX
71
72#define SIZE_MAX ULONG_MAX
73
74#define INT8_C(x) x
75#define INT16_C(x) x
76#define INT32_C(x) x
77
78#define UINT8_C(x) x
79#define UINT16_C(x) x
80#define UINT32_C(x) x ## U
81
82#define INTMAX_C(x) x ## LL
83#define UINTMAX_C(x) x ## ULL
84
85typedef signed char int8_t;
86typedef short int16_t;
87typedef int int32_t;
88
89typedef unsigned char uint8_t;
90typedef unsigned short uint16_t;
91typedef unsigned int uint32_t;
92
Imre Kis650ae322024-05-28 15:59:48 +020093typedef signed char int_least8_t;
94typedef short int_least16_t;
95typedef int int_least32_t;
Imre Kisf55f2aa2024-05-28 15:55:19 +020096
Imre Kis650ae322024-05-28 15:59:48 +020097typedef unsigned char uint_least8_t;
98typedef unsigned short uint_least16_t;
99typedef unsigned int uint_least32_t;
Imre Kisf55f2aa2024-05-28 15:55:19 +0200100
Imre Kis650ae322024-05-28 15:59:48 +0200101typedef int int_fast8_t;
102typedef int int_fast16_t;
103typedef int int_fast32_t;
Imre Kisf55f2aa2024-05-28 15:55:19 +0200104
Imre Kis650ae322024-05-28 15:59:48 +0200105typedef unsigned int uint_fast8_t;
106typedef unsigned int uint_fast16_t;
107typedef unsigned int uint_fast32_t;
Imre Kisf55f2aa2024-05-28 15:55:19 +0200108
109typedef long intptr_t;
110typedef unsigned long uintptr_t;
111
112/*
113* Conceptually, these are supposed to be the largest integers representable in C,
114* but GCC and Clang define them as long long for compatibility.
115*/
116typedef long long intmax_t;
117typedef unsigned long long uintmax_t;
118
119typedef long register_t;
120typedef unsigned long u_register_t;
121
122#endif /* STDINT_H */