blob: 88502e7a3555de0f904ebf75da3c210cbaecc288 [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/*
Govindraj Rajaeee28e72023-08-01 15:52:40 -05007 * 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>
Scott Brandene5dcf982020-08-25 13:49:32 -070015#include <stdint_.h>
Bence Szépkútifddf5182019-10-25 17:48:20 +020016
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
Bence Szépkútifddf5182019-10-25 17:48:20 +020029#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
Bence Szépkúticf175782019-12-16 14:57:40 +010072#define SIZE_MAX ULONG_MAX
Bence Szépkútifddf5182019-10-25 17:48:20 +020073
74#define INT8_C(x) x
75#define INT16_C(x) x
76#define INT32_C(x) x
Bence Szépkútifddf5182019-10-25 17:48:20 +020077
78#define UINT8_C(x) x
79#define UINT16_C(x) x
80#define UINT32_C(x) x ## U
Bence Szépkútifddf5182019-10-25 17:48:20 +020081
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;
Bence Szépkútifddf5182019-10-25 17:48:20 +020088
89typedef unsigned char uint8_t;
90typedef unsigned short uint16_t;
91typedef unsigned int uint32_t;
Bence Szépkútifddf5182019-10-25 17:48:20 +020092
93typedef signed char int8_least_t;
94typedef short int16_least_t;
95typedef int int32_least_t;
Bence Szépkútifddf5182019-10-25 17:48:20 +020096
97typedef unsigned char uint8_least_t;
98typedef unsigned short uint16_least_t;
99typedef unsigned int uint32_least_t;
Bence Szépkútifddf5182019-10-25 17:48:20 +0200100
101typedef int int8_fast_t;
102typedef int int16_fast_t;
103typedef int int32_fast_t;
Bence Szépkútifddf5182019-10-25 17:48:20 +0200104
105typedef unsigned int uint8_fast_t;
106typedef unsigned int uint16_fast_t;
107typedef unsigned int uint32_fast_t;
Bence Szépkútifddf5182019-10-25 17:48:20 +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
Antonio Nino Diaz17605e72018-08-14 13:39:29 +0100122#endif /* STDINT_H */