blob: 80b3e965dabae0b9ab6dae433f12e2f3b0442fe5 [file] [log] [blame]
Antonio Nino Diazcf0f8052018-08-17 10:45:47 +01001/*
2 * Copyright (c) 2012-2017 Roberto E. Vargas Caballero
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
Antonio Nino Diaz6ef16122018-08-15 19:51:09 +01006/*
Bence Szépkútifddf5182019-10-25 17:48:20 +02007 * Portions copyright (c) 2018-2019, ARM Limited and Contributors.
Antonio Nino Diaz6ef16122018-08-15 19:51:09 +01008 * All rights reserved.
9 */
Antonio Nino Diazcf0f8052018-08-17 10:45:47 +010010
Antonio Nino Diaz17605e72018-08-14 13:39:29 +010011#ifndef STDINT_H
12#define STDINT_H
Antonio Nino Diazcf0f8052018-08-17 10:45:47 +010013
Bence Szépkútifddf5182019-10-25 17:48:20 +020014#include <limits.h>
15
16#define INT8_MAX CHAR_MAX
17#define INT8_MIN CHAR_MIN
18#define UINT8_MAX UCHAR_MAX
19
20#define INT16_MAX SHRT_MAX
21#define INT16_MIN SHRT_MIN
22#define UINT16_MAX USHRT_MAX
23
24#define INT32_MAX INT_MAX
25#define INT32_MIN INT_MIN
26#define UINT32_MAX UINT_MAX
27
28#define INT64_MAX LLONG_MAX
29#define INT64_MIN LLONG_MIN
30#define UINT64_MAX ULLONG_MAX
31
32#define INT_LEAST8_MIN INT8_MIN
33#define INT_LEAST8_MAX INT8_MAX
34#define UINT_LEAST8_MAX UINT8_MAX
35
36#define INT_LEAST16_MIN INT16_MIN
37#define INT_LEAST16_MAX INT16_MAX
38#define UINT_LEAST16_MAX UINT16_MAX
39
40#define INT_LEAST32_MIN INT32_MIN
41#define INT_LEAST32_MAX INT32_MAX
42#define UINT_LEAST32_MAX UINT32_MAX
43
44#define INT_LEAST64_MIN INT64_MIN
45#define INT_LEAST64_MAX INT64_MAX
46#define UINT_LEAST64_MAX UINT64_MAX
47
48#define INT_FAST8_MIN INT32_MIN
49#define INT_FAST8_MAX INT32_MAX
50#define UINT_FAST8_MAX UINT32_MAX
51
52#define INT_FAST16_MIN INT32_MIN
53#define INT_FAST16_MAX INT32_MAX
54#define UINT_FAST16_MAX UINT32_MAX
55
56#define INT_FAST32_MIN INT32_MIN
57#define INT_FAST32_MAX INT32_MAX
58#define UINT_FAST32_MAX UINT32_MAX
59
60#define INT_FAST64_MIN INT64_MIN
61#define INT_FAST64_MAX INT64_MAX
62#define UINT_FAST64_MAX UINT64_MAX
63
64#define INTPTR_MIN LONG_MIN
65#define INTPTR_MAX LONG_MAX
66#define UINTPTR_MAX ULONG_MAX
67
68#define INTMAX_MIN LLONG_MIN
69#define INTMAX_MAX LLONG_MAX
70#define UINTMAX_MAX ULLONG_MAX
71
72#define PTRDIFF_MIN LONG_MIN
73#define PTRDIFF_MAX LONG_MAX
74
75#define SIZE_MAX UINT64_MAX
76
77#define INT8_C(x) x
78#define INT16_C(x) x
79#define INT32_C(x) x
80#define INT64_C(x) x ## LL
81
82#define UINT8_C(x) x
83#define UINT16_C(x) x
84#define UINT32_C(x) x ## U
85#define UINT64_C(x) x ## ULL
86
87#define INTMAX_C(x) x ## LL
88#define UINTMAX_C(x) x ## ULL
89
90typedef signed char int8_t;
91typedef short int16_t;
92typedef int int32_t;
93typedef long long int64_t;
94
95typedef unsigned char uint8_t;
96typedef unsigned short uint16_t;
97typedef unsigned int uint32_t;
98typedef unsigned long long uint64_t;
99
100typedef signed char int8_least_t;
101typedef short int16_least_t;
102typedef int int32_least_t;
103typedef long long int64_least_t;
104
105typedef unsigned char uint8_least_t;
106typedef unsigned short uint16_least_t;
107typedef unsigned int uint32_least_t;
108typedef unsigned long long uint64_least_t;
109
110typedef int int8_fast_t;
111typedef int int16_fast_t;
112typedef int int32_fast_t;
113typedef long long int64_fast_t;
114
115typedef unsigned int uint8_fast_t;
116typedef unsigned int uint16_fast_t;
117typedef unsigned int uint32_fast_t;
118typedef unsigned long long uint64_fast_t;
119
120typedef long intptr_t;
121typedef unsigned long uintptr_t;
122
123/*
124* Conceptually, these are supposed to be the largest integers representable in C,
125* but GCC and Clang define them as long long for compatibility.
126*/
127typedef long long intmax_t;
128typedef unsigned long long uintmax_t;
129
130typedef long register_t;
131typedef unsigned long u_register_t;
132
133#ifdef __aarch64__
134typedef __int128 int128_t;
135typedef unsigned __int128 uint128_t;
136#endif /* __aarch64__ */
Antonio Nino Diazcf0f8052018-08-17 10:45:47 +0100137
Antonio Nino Diaz17605e72018-08-14 13:39:29 +0100138#endif /* STDINT_H */