1 /*
2  * Copyright (c) 2012-2017 Roberto E. Vargas Caballero
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 /*
7  * Portions copyright (c) 2018-2019, Arm Limited and Contributors.
8  * 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 
85 typedef signed char int8_t;
86 typedef short int16_t;
87 typedef int int32_t;
88 
89 typedef unsigned char uint8_t;
90 typedef unsigned short uint16_t;
91 typedef unsigned int uint32_t;
92 
93 typedef signed char int8_least_t;
94 typedef short int16_least_t;
95 typedef int int32_least_t;
96 
97 typedef unsigned char uint8_least_t;
98 typedef unsigned short uint16_least_t;
99 typedef unsigned int uint32_least_t;
100 
101 typedef int int8_fast_t;
102 typedef int int16_fast_t;
103 typedef int int32_fast_t;
104 
105 typedef unsigned int uint8_fast_t;
106 typedef unsigned int uint16_fast_t;
107 typedef unsigned int uint32_fast_t;
108 
109 typedef long intptr_t;
110 typedef 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 */
116 typedef long long intmax_t;
117 typedef unsigned long long uintmax_t;
118 
119 typedef long register_t;
120 typedef unsigned long u_register_t;
121 
122 #endif /* STDINT_H */
123