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 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 ULONG_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 90 typedef signed char int8_t; 91 typedef short int16_t; 92 typedef int int32_t; 93 typedef long long int64_t; 94 95 typedef unsigned char uint8_t; 96 typedef unsigned short uint16_t; 97 typedef unsigned int uint32_t; 98 typedef unsigned long long uint64_t; 99 100 typedef signed char int8_least_t; 101 typedef short int16_least_t; 102 typedef int int32_least_t; 103 typedef long long int64_least_t; 104 105 typedef unsigned char uint8_least_t; 106 typedef unsigned short uint16_least_t; 107 typedef unsigned int uint32_least_t; 108 typedef unsigned long long uint64_least_t; 109 110 typedef int int8_fast_t; 111 typedef int int16_fast_t; 112 typedef int int32_fast_t; 113 typedef long long int64_fast_t; 114 115 typedef unsigned int uint8_fast_t; 116 typedef unsigned int uint16_fast_t; 117 typedef unsigned int uint32_fast_t; 118 typedef unsigned long long uint64_fast_t; 119 120 typedef long intptr_t; 121 typedef 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 */ 127 typedef long long intmax_t; 128 typedef unsigned long long uintmax_t; 129 130 typedef long register_t; 131 typedef unsigned long u_register_t; 132 133 #ifdef __aarch64__ 134 typedef __int128 int128_t; 135 typedef unsigned __int128 uint128_t; 136 #endif /* __aarch64__ */ 137 138 #endif /* STDINT_H */ 139