1 /* stdint.h */ 2 3 /* 4 * Copyright (c) 2014 Wind River Systems, Inc. 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDINT_H_ 10 #define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDINT_H_ 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 #define INT8_MAX __INT8_MAX__ 17 #define INT16_MAX __INT16_MAX__ 18 #define INT32_MAX __INT32_MAX__ 19 #define INT64_MAX __INT64_MAX__ 20 #define INTMAX_MAX __INT64_MAX__ 21 22 #define INT8_MIN (-INT8_MAX - 1) 23 #define INT16_MIN (-INT16_MAX - 1) 24 #define INT32_MIN (-INT32_MAX - 1) 25 #define INT64_MIN (-INT64_MAX - 1LL) 26 27 #define UINT8_MAX __UINT8_MAX__ 28 #define UINT16_MAX __UINT16_MAX__ 29 #define UINT32_MAX __UINT32_MAX__ 30 #define UINT64_MAX __UINT64_MAX__ 31 #define UINTMAX_MAX __UINT64_MAX__ 32 33 #define INT_FAST8_MAX __INT_FAST8_MAX__ 34 #define INT_FAST16_MAX __INT_FAST16_MAX__ 35 #define INT_FAST32_MAX __INT_FAST32_MAX__ 36 #define INT_FAST64_MAX __INT_FAST64_MAX__ 37 38 #define INT_FAST8_MIN (-INT_FAST8_MAX - 1) 39 #define INT_FAST16_MIN (-INT_FAST16_MAX - 1) 40 #define INT_FAST32_MIN (-INT_FAST32_MAX - 1) 41 #define INT_FAST64_MIN (-INT_FAST64_MAX - 1LL) 42 43 #define UINT_FAST8_MAX __UINT_FAST8_MAX__ 44 #define UINT_FAST16_MAX __UINT_FAST16_MAX__ 45 #define UINT_FAST32_MAX __UINT_FAST32_MAX__ 46 #define UINT_FAST64_MAX __UINT_FAST64_MAX__ 47 48 #define INT_LEAST8_MAX __INT_LEAST8_MAX__ 49 #define INT_LEAST16_MAX __INT_LEAST16_MAX__ 50 #define INT_LEAST32_MAX __INT_LEAST32_MAX__ 51 #define INT_LEAST64_MAX __INT_LEAST64_MAX__ 52 53 #define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1) 54 #define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1) 55 #define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1) 56 #define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1LL) 57 58 #define UINT_LEAST8_MAX __UINT_LEAST8_MAX__ 59 #define UINT_LEAST16_MAX __UINT_LEAST16_MAX__ 60 #define UINT_LEAST32_MAX __UINT_LEAST32_MAX__ 61 #define UINT_LEAST64_MAX __UINT_LEAST64_MAX__ 62 63 #define INTPTR_MAX __INTPTR_MAX__ 64 #define INTPTR_MIN (-INTPTR_MAX - 1) 65 #define UINTPTR_MAX __UINTPTR_MAX__ 66 67 #define PTRDIFF_MAX __PTRDIFF_MAX__ 68 #define PTRDIFF_MIN (-PTRDIFF_MAX - 1) 69 70 #define SIZE_MAX __SIZE_MAX__ 71 72 typedef __INT8_TYPE__ int8_t; 73 typedef __INT16_TYPE__ int16_t; 74 typedef __INT32_TYPE__ int32_t; 75 typedef __INT64_TYPE__ int64_t; 76 typedef __INT64_TYPE__ intmax_t; 77 78 typedef __INT_FAST8_TYPE__ int_fast8_t; 79 typedef __INT_FAST16_TYPE__ int_fast16_t; 80 typedef __INT_FAST32_TYPE__ int_fast32_t; 81 typedef __INT_FAST64_TYPE__ int_fast64_t; 82 83 typedef __INT_LEAST8_TYPE__ int_least8_t; 84 typedef __INT_LEAST16_TYPE__ int_least16_t; 85 typedef __INT_LEAST32_TYPE__ int_least32_t; 86 typedef __INT_LEAST64_TYPE__ int_least64_t; 87 88 typedef __UINT8_TYPE__ uint8_t; 89 typedef __UINT16_TYPE__ uint16_t; 90 typedef __UINT32_TYPE__ uint32_t; 91 typedef __UINT64_TYPE__ uint64_t; 92 typedef __UINT64_TYPE__ uintmax_t; 93 94 typedef __UINT_FAST8_TYPE__ uint_fast8_t; 95 typedef __UINT_FAST16_TYPE__ uint_fast16_t; 96 typedef __UINT_FAST32_TYPE__ uint_fast32_t; 97 typedef __UINT_FAST64_TYPE__ uint_fast64_t; 98 99 typedef __UINT_LEAST8_TYPE__ uint_least8_t; 100 typedef __UINT_LEAST16_TYPE__ uint_least16_t; 101 typedef __UINT_LEAST32_TYPE__ uint_least32_t; 102 typedef __UINT_LEAST64_TYPE__ uint_least64_t; 103 104 typedef __INTPTR_TYPE__ intptr_t; 105 typedef __UINTPTR_TYPE__ uintptr_t; 106 107 #ifdef __GNUC__ 108 /* These macros must produce constant integer expressions, which can't 109 * be done in the preprocessor (casts aren't allowed). Defer to the 110 * GCC internal functions where they're available. 111 */ 112 #define INT8_C(_v) __INT8_C(_v) 113 #define INT16_C(_v) __INT16_C(_v) 114 #define INT32_C(_v) __INT32_C(_v) 115 #define INT64_C(_v) __INT64_C(_v) 116 #define INTMAX_C(_v) __INTMAX_C(_v) 117 118 #define UINT8_C(_v) __UINT8_C(_v) 119 #define UINT16_C(_v) __UINT16_C(_v) 120 #define UINT32_C(_v) __UINT32_C(_v) 121 #define UINT64_C(_v) __UINT64_C(_v) 122 #define UINTMAX_C(_v) __UINTMAX_C(_v) 123 #endif /* __GNUC__ */ 124 125 #ifdef __CCAC__ 126 #ifndef __INT8_C 127 #define __INT8_C(x) x 128 #endif 129 130 #ifndef INT8_C 131 #define INT8_C(x) __INT8_C(x) 132 #endif 133 134 #ifndef __UINT8_C 135 #define __UINT8_C(x) x ## U 136 #endif 137 138 #ifndef UINT8_C 139 #define UINT8_C(x) __UINT8_C(x) 140 #endif 141 142 #ifndef __INT16_C 143 #define __INT16_C(x) x 144 #endif 145 146 #ifndef INT16_C 147 #define INT16_C(x) __INT16_C(x) 148 #endif 149 150 #ifndef __UINT16_C 151 #define __UINT16_C(x) x ## U 152 #endif 153 154 #ifndef UINT16_C 155 #define UINT16_C(x) __UINT16_C(x) 156 #endif 157 158 #ifndef __INT32_C 159 #define __INT32_C(x) x 160 #endif 161 162 #ifndef INT32_C 163 #define INT32_C(x) __INT32_C(x) 164 #endif 165 166 #ifndef __UINT32_C 167 #define __UINT32_C(x) x ## U 168 #endif 169 170 #ifndef UINT32_C 171 #define UINT32_C(x) __UINT32_C(x) 172 #endif 173 174 #ifndef __INT64_C 175 #define __INT64_C(x) x 176 #endif 177 178 #ifndef INT64_C 179 #define INT64_C(x) __INT64_C(x) 180 #endif 181 182 #ifndef __UINT64_C 183 #define __UINT64_C(x) x ## ULL 184 #endif 185 186 #ifndef UINT64_C 187 #define UINT64_C(x) __UINT64_C(x) 188 #endif 189 190 #ifndef __INTMAX_C 191 #define __INTMAX_C(x) x 192 #endif 193 194 #ifndef INTMAX_C 195 #define INTMAX_C(x) __INTMAX_C(x) 196 #endif 197 198 #ifndef __UINTMAX_C 199 #define __UINTMAX_C(x) x ## ULL 200 #endif 201 202 #ifndef UINTMAX_C 203 #define UINTMAX_C(x) __UINTMAX_C(x) 204 #endif 205 #endif /* __CCAC__ */ 206 207 #ifdef __cplusplus 208 } 209 #endif 210 211 #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDINT_H_ */ 212