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 INTPTR_MAX __INTPTR_MAX__ 34 #define INTPTR_MIN (-INTPTR_MAX - 1) 35 #define UINTPTR_MAX __UINTPTR_MAX__ 36 37 #define PTRDIFF_MAX __PTRDIFF_MAX__ 38 #define PTRDIFF_MIN (-PTRDIFF_MAX - 1) 39 40 #define SIZE_MAX __SIZE_MAX__ 41 42 typedef __INT8_TYPE__ int8_t; 43 typedef __INT16_TYPE__ int16_t; 44 typedef __INT32_TYPE__ int32_t; 45 typedef __INT64_TYPE__ int64_t; 46 typedef __INT64_TYPE__ intmax_t; 47 48 typedef __INT_FAST8_TYPE__ int_fast8_t; 49 typedef __INT_FAST16_TYPE__ int_fast16_t; 50 typedef __INT_FAST32_TYPE__ int_fast32_t; 51 typedef __INT_FAST64_TYPE__ int_fast64_t; 52 53 typedef __INT_LEAST8_TYPE__ int_least8_t; 54 typedef __INT_LEAST16_TYPE__ int_least16_t; 55 typedef __INT_LEAST32_TYPE__ int_least32_t; 56 typedef __INT_LEAST64_TYPE__ int_least64_t; 57 58 typedef __UINT8_TYPE__ uint8_t; 59 typedef __UINT16_TYPE__ uint16_t; 60 typedef __UINT32_TYPE__ uint32_t; 61 typedef __UINT64_TYPE__ uint64_t; 62 typedef __UINT64_TYPE__ uintmax_t; 63 64 typedef __UINT_FAST8_TYPE__ uint_fast8_t; 65 typedef __UINT_FAST16_TYPE__ uint_fast16_t; 66 typedef __UINT_FAST32_TYPE__ uint_fast32_t; 67 typedef __UINT_FAST64_TYPE__ uint_fast64_t; 68 69 typedef __UINT_LEAST8_TYPE__ uint_least8_t; 70 typedef __UINT_LEAST16_TYPE__ uint_least16_t; 71 typedef __UINT_LEAST32_TYPE__ uint_least32_t; 72 typedef __UINT_LEAST64_TYPE__ uint_least64_t; 73 74 typedef __INTPTR_TYPE__ intptr_t; 75 typedef __UINTPTR_TYPE__ uintptr_t; 76 77 #ifdef __GNUC__ 78 /* These macros must produce constant integer expressions, which can't 79 * be done in the preprocessor (casts aren't allowed). Defer to the 80 * GCC internal functions where they're available. 81 */ 82 #define INT8_C(_v) __INT8_C(_v) 83 #define INT16_C(_v) __INT16_C(_v) 84 #define INT32_C(_v) __INT32_C(_v) 85 #define INT64_C(_v) __INT64_C(_v) 86 #define INTMAX_C(_v) __INTMAX_C(_v) 87 88 #define UINT8_C(_v) __UINT8_C(_v) 89 #define UINT16_C(_v) __UINT16_C(_v) 90 #define UINT32_C(_v) __UINT32_C(_v) 91 #define UINT64_C(_v) __UINT64_C(_v) 92 #define UINTMAX_C(_v) __UINTMAX_C(_v) 93 #endif /* __GNUC__ */ 94 95 #ifdef __CCAC__ 96 #ifndef __INT8_C 97 #define __INT8_C(x) x 98 #endif 99 100 #ifndef INT8_C 101 #define INT8_C(x) __INT8_C(x) 102 #endif 103 104 #ifndef __UINT8_C 105 #define __UINT8_C(x) x ## U 106 #endif 107 108 #ifndef UINT8_C 109 #define UINT8_C(x) __UINT8_C(x) 110 #endif 111 112 #ifndef __INT16_C 113 #define __INT16_C(x) x 114 #endif 115 116 #ifndef INT16_C 117 #define INT16_C(x) __INT16_C(x) 118 #endif 119 120 #ifndef __UINT16_C 121 #define __UINT16_C(x) x ## U 122 #endif 123 124 #ifndef UINT16_C 125 #define UINT16_C(x) __UINT16_C(x) 126 #endif 127 128 #ifndef __INT32_C 129 #define __INT32_C(x) x 130 #endif 131 132 #ifndef INT32_C 133 #define INT32_C(x) __INT32_C(x) 134 #endif 135 136 #ifndef __UINT32_C 137 #define __UINT32_C(x) x ## U 138 #endif 139 140 #ifndef UINT32_C 141 #define UINT32_C(x) __UINT32_C(x) 142 #endif 143 144 #ifndef __INT64_C 145 #define __INT64_C(x) x 146 #endif 147 148 #ifndef INT64_C 149 #define INT64_C(x) __INT64_C(x) 150 #endif 151 152 #ifndef __UINT64_C 153 #define __UINT64_C(x) x ## ULL 154 #endif 155 156 #ifndef UINT64_C 157 #define UINT64_C(x) __UINT64_C(x) 158 #endif 159 160 #ifndef __INTMAX_C 161 #define __INTMAX_C(x) x 162 #endif 163 164 #ifndef INTMAX_C 165 #define INTMAX_C(x) __INTMAX_C(x) 166 #endif 167 168 #ifndef __UINTMAX_C 169 #define __UINTMAX_C(x) x ## ULL 170 #endif 171 172 #ifndef UINTMAX_C 173 #define UINTMAX_C(x) __UINTMAX_C(x) 174 #endif 175 #endif /* __CCAC__ */ 176 177 #ifdef __cplusplus 178 } 179 #endif 180 181 #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDINT_H_ */ 182