Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 1 | /*===---- stdint.h - Standard header for sized integer types --------------===*\ |
| 2 | * |
| 3 | * Copyright (c) 2009 Chris Lattner |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | * of this software and associated documentation files (the "Software"), to deal |
| 7 | * in the Software without restriction, including without limitation the rights |
| 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | * copies of the Software, and to permit persons to whom the Software is |
| 10 | * furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included in |
| 13 | * all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 21 | * THE SOFTWARE. |
| 22 | * |
| 23 | \*===----------------------------------------------------------------------===*/ |
| 24 | |
Eli Friedman | 6fdca0e | 2009-05-03 23:00:48 +0000 | [diff] [blame] | 25 | #ifndef __CLANG_STDINT_H |
| 26 | #define __CLANG_STDINT_H |
| 27 | |
| 28 | /* If we're hosted, fall back to the system's stdint.h, which might have |
| 29 | * additional definitions. |
| 30 | */ |
John Thompson | 92bd8c7 | 2009-11-02 22:28:12 +0000 | [diff] [blame] | 31 | #if __STDC_HOSTED__ && \ |
| 32 | defined(__has_include_next) && __has_include_next(<stdint.h>) |
Eli Friedman | 6fdca0e | 2009-05-03 23:00:48 +0000 | [diff] [blame] | 33 | # include_next <stdint.h> |
| 34 | #else |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 35 | |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 36 | /* C99 7.18.1.1 Exact-width integer types. |
| 37 | * C99 7.18.1.2 Minimum-width integer types. |
| 38 | * C99 7.18.1.3 Fastest minimum-width integer types. |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 39 | * |
| 40 | * The standard requires that exact-width type be defined for 8-, 16-, 32-, and |
| 41 | * 64-bit types if they are implemented. Other exact width types are optional. |
| 42 | * This implementation defines an exact-width types for every integer width |
| 43 | * that is represented in the standard integer types. |
| 44 | * |
| 45 | * The standard also requires minimum-width types be defined for 8-, 16-, 32-, |
| 46 | * and 64-bit widths regardless of whether there are corresponding exact-width |
| 47 | * types. |
| 48 | * |
| 49 | * To accomodate targets that are missing types that are exactly 8, 16, 32, or |
| 50 | * 64 bits wide, this implementation takes an approach of cascading |
| 51 | * redefintions, redefining __int_leastN_t to successively smaller exact-width |
| 52 | * types. It is therefore important that the types are defined in order of |
| 53 | * descending widths. |
| 54 | * |
| 55 | * We currently assume that the minimum-width types and the fastest |
| 56 | * minimum-width types are the same. This is allowed by the standard, but is |
| 57 | * suboptimal. |
| 58 | * |
| 59 | * In violation of the standard, some targets do not implement a type that is |
| 60 | * wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit). |
| 61 | * To accomodate these targets, a required minimum-width type is only |
| 62 | * defined if there exists an exact-width type of equal or greater width. |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 63 | */ |
| 64 | |
Chris Lattner | ca93195 | 2009-04-18 19:11:11 +0000 | [diff] [blame] | 65 | #ifdef __INT64_TYPE__ |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 66 | # ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/ |
| 67 | typedef signed __INT64_TYPE__ int64_t; |
| 68 | # endif /* __int8_t_defined */ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 69 | typedef unsigned __INT64_TYPE__ uint64_t; |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 70 | # define __int_least64_t int64_t |
| 71 | # define __uint_least64_t uint64_t |
| 72 | # define __int_least32_t int64_t |
| 73 | # define __uint_least32_t uint64_t |
| 74 | # define __int_least16_t int64_t |
| 75 | # define __uint_least16_t uint64_t |
| 76 | # define __int_least8_t int64_t |
| 77 | # define __uint_least8_t uint64_t |
| 78 | #endif /* __INT64_TYPE__ */ |
Chris Lattner | ca93195 | 2009-04-18 19:11:11 +0000 | [diff] [blame] | 79 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 80 | #ifdef __int_least64_t |
| 81 | typedef __int_least64_t int_least64_t; |
| 82 | typedef __uint_least64_t uint_least64_t; |
| 83 | typedef __int_least64_t int_fast64_t; |
| 84 | typedef __uint_least64_t uint_fast64_t; |
| 85 | #endif /* __int_least64_t */ |
| 86 | |
| 87 | #ifdef __INT56_TYPE__ |
| 88 | typedef signed __INT56_TYPE__ int56_t; |
| 89 | typedef unsigned __INT56_TYPE__ uint56_t; |
| 90 | typedef int56_t int_least56_t; |
| 91 | typedef uint56_t uint_least56_t; |
| 92 | typedef int56_t int_fast56_t; |
| 93 | typedef uint56_t uint_fast56_t; |
| 94 | # define __int_least32_t int56_t |
| 95 | # define __uint_least32_t uint56_t |
| 96 | # define __int_least16_t int56_t |
| 97 | # define __uint_least16_t uint56_t |
| 98 | # define __int_least8_t int56_t |
| 99 | # define __uint_least8_t uint56_t |
| 100 | #endif /* __INT56_TYPE__ */ |
| 101 | |
| 102 | |
| 103 | #ifdef __INT48_TYPE__ |
| 104 | typedef signed __INT48_TYPE__ int48_t; |
| 105 | typedef unsigned __INT48_TYPE__ uint48_t; |
| 106 | typedef int48_t int_least48_t; |
| 107 | typedef uint48_t uint_least48_t; |
| 108 | typedef int48_t int_fast48_t; |
| 109 | typedef uint48_t uint_fast48_t; |
| 110 | # define __int_least32_t int48_t |
| 111 | # define __uint_least32_t uint48_t |
| 112 | # define __int_least16_t int48_t |
| 113 | # define __uint_least16_t uint48_t |
| 114 | # define __int_least8_t int48_t |
| 115 | # define __uint_least8_t uint48_t |
| 116 | #endif /* __INT48_TYPE__ */ |
| 117 | |
| 118 | |
| 119 | #ifdef __INT40_TYPE__ |
| 120 | typedef signed __INT40_TYPE__ int40_t; |
| 121 | typedef unsigned __INT40_TYPE__ uint40_t; |
| 122 | typedef int40_t int_least40_t; |
| 123 | typedef uint40_t uint_least40_t; |
| 124 | typedef int40_t int_fast40_t; |
| 125 | typedef uint40_t uint_fast40_t; |
| 126 | # define __int_least32_t int40_t |
| 127 | # define __uint_least32_t uint40_t |
| 128 | # define __int_least16_t int40_t |
| 129 | # define __uint_least16_t uint40_t |
| 130 | # define __int_least8_t int40_t |
| 131 | # define __uint_least8_t uint40_t |
| 132 | #endif /* __INT40_TYPE__ */ |
| 133 | |
| 134 | |
| 135 | #ifdef __INT32_TYPE__ |
| 136 | |
| 137 | # ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/ |
| 138 | typedef signed __INT32_TYPE__ int32_t; |
| 139 | # endif /* __int8_t_defined */ |
| 140 | |
| 141 | # ifndef __uint32_t_defined /* more glibc compatibility */ |
| 142 | # define __uint32_t_defined |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 143 | typedef unsigned __INT32_TYPE__ uint32_t; |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 144 | # endif /* __uint32_t_defined */ |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 145 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 146 | # define __int_least32_t int32_t |
| 147 | # define __uint_least32_t uint32_t |
| 148 | # define __int_least16_t int32_t |
| 149 | # define __uint_least16_t uint32_t |
| 150 | # define __int_least8_t int32_t |
| 151 | # define __uint_least8_t uint32_t |
| 152 | #endif /* __INT32_TYPE__ */ |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 153 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 154 | #ifdef __int_least32_t |
| 155 | typedef __int_least32_t int_least32_t; |
| 156 | typedef __uint_least32_t uint_least32_t; |
| 157 | typedef __int_least32_t int_fast32_t; |
| 158 | typedef __uint_least32_t uint_fast32_t; |
| 159 | #endif /* __int_least32_t */ |
| 160 | |
| 161 | #ifdef __INT24_TYPE__ |
| 162 | typedef signed __INT24_TYPE__ int24_t; |
| 163 | typedef unsigned __INT24_TYPE__ uint24_t; |
| 164 | typedef int24_t int_least24_t; |
| 165 | typedef uint24_t uint_least24_t; |
| 166 | typedef int24_t int_fast24_t; |
| 167 | typedef uint24_t uint_fast24_t; |
| 168 | # define __int_least16_t int24_t |
| 169 | # define __uint_least16_t uint24_t |
| 170 | # define __int_least8_t int24_t |
| 171 | # define __uint_least8_t uint24_t |
| 172 | #endif /* __INT24_TYPE__ */ |
| 173 | |
| 174 | #ifdef __INT16_TYPE__ |
| 175 | #ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/ |
| 176 | typedef signed __INT16_TYPE__ int16_t; |
| 177 | #endif /* __int8_t_defined */ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 178 | typedef unsigned __INT16_TYPE__ uint16_t; |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 179 | # define __int_least16_t int16_t |
| 180 | # define __uint_least16_t uint16_t |
| 181 | # define __int_least8_t int16_t |
| 182 | # define __uint_least8_t uint16_t |
| 183 | #endif /* __INT16_TYPE__ */ |
| 184 | |
| 185 | #ifdef __int_least16_t |
| 186 | typedef __int_least16_t int_least16_t; |
| 187 | typedef __uint_least16_t uint_least16_t; |
| 188 | typedef __int_least16_t int_fast16_t; |
| 189 | typedef __uint_least16_t uint_fast16_t; |
| 190 | #endif /* __int_least16_t */ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 191 | |
| 192 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 193 | #ifdef __INT8_TYPE__ |
| 194 | #ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 195 | typedef signed __INT8_TYPE__ int8_t; |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 196 | #endif /* __int8_t_defined */ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 197 | typedef unsigned __INT8_TYPE__ uint8_t; |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 198 | # define __int_least8_t int8_t |
| 199 | # define __uint_least8_t uint8_t |
| 200 | #endif /* __INT8_TYPE__ */ |
| 201 | |
| 202 | #ifdef __int_least8_t |
| 203 | typedef __int_least8_t int_least8_t; |
| 204 | typedef __uint_least8_t uint_least8_t; |
| 205 | typedef __int_least8_t int_fast8_t; |
| 206 | typedef __uint_least8_t uint_fast8_t; |
| 207 | #endif /* __int_least8_t */ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 208 | |
| 209 | /* prevent glibc sys/types.h from defining conflicting types */ |
| 210 | #ifndef __int8_t_defined |
| 211 | # define __int8_t_defined |
| 212 | #endif /* __int8_t_defined */ |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 213 | |
| 214 | /* C99 7.18.1.4 Integer types capable of holding object pointers. |
| 215 | */ |
Ken Dyck | 08321b4 | 2009-11-18 20:24:13 +0000 | [diff] [blame] | 216 | #define __stdint_join3(a,b,c) a ## b ## c |
Ken Dyck | 08321b4 | 2009-11-18 20:24:13 +0000 | [diff] [blame] | 217 | |
Ken Dyck | aface1b | 2009-11-20 16:37:35 +0000 | [diff] [blame] | 218 | #define __intn_t(n) __stdint_join3( int, n, _t) |
| 219 | #define __uintn_t(n) __stdint_join3(uint, n, _t) |
| 220 | |
Chris Lattner | 40e60c2 | 2009-02-13 22:43:13 +0000 | [diff] [blame] | 221 | #ifndef __intptr_t_defined |
Ken Dyck | aface1b | 2009-11-20 16:37:35 +0000 | [diff] [blame] | 222 | typedef __intn_t(__INTPTR_WIDTH__) intptr_t; |
Chris Lattner | 40e60c2 | 2009-02-13 22:43:13 +0000 | [diff] [blame] | 223 | #define __intptr_t_defined |
| 224 | #endif |
Ken Dyck | aface1b | 2009-11-20 16:37:35 +0000 | [diff] [blame] | 225 | typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t; |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 226 | |
| 227 | /* C99 7.18.1.5 Greatest-width integer types. |
| 228 | */ |
Ken Dyck | aface1b | 2009-11-20 16:37:35 +0000 | [diff] [blame] | 229 | typedef __intn_t(__INTMAX_WIDTH__) intmax_t; |
| 230 | typedef __uintn_t(__INTMAX_WIDTH__) uintmax_t; |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 231 | |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 232 | /* C99 7.18.4 Macros for minimum-width integer constants. |
| 233 | * |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 234 | * The standard requires that integer constant macros be defined for all the |
| 235 | * minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width |
| 236 | * types are required, the corresponding integer constant macros are defined |
| 237 | * here. This implementation also defines minimum-width types for every other |
| 238 | * integer width that the target implements, so corresponding macros are |
| 239 | * defined below, too. |
| 240 | * |
| 241 | * These macros are defined using the same successive-shrinking approach as |
| 242 | * the type definitions above. It is likewise important that macros are defined |
| 243 | * in order of decending width. |
| 244 | * |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 245 | * Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the |
| 246 | * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]). |
| 247 | */ |
| 248 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 249 | #define __int_c_join(a, b) a ## b |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 250 | #define __int_c(v, suffix) __int_c_join(v, suffix) |
| 251 | #define __uint_c(v, suffix) __int_c_join(v##U, suffix) |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 252 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 253 | |
| 254 | #ifdef __INT64_TYPE__ |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 255 | # ifdef __INT64_C_SUFFIX__ |
| 256 | # define __int64_c_suffix __INT64_C_SUFFIX__ |
| 257 | # define __int32_c_suffix __INT64_C_SUFFIX__ |
| 258 | # define __int16_c_suffix __INT64_C_SUFFIX__ |
| 259 | # define __int8_c_suffix __INT64_C_SUFFIX__ |
| 260 | # else |
| 261 | # undef __int64_c_suffix |
| 262 | # undef __int32_c_suffix |
| 263 | # undef __int16_c_suffix |
| 264 | # undef __int8_c_suffix |
| 265 | # endif /* __INT64_C_SUFFIX__ */ |
| 266 | #endif /* __INT64_TYPE__ */ |
| 267 | |
| 268 | #ifdef __int_least64_t |
| 269 | # ifdef __int64_c_suffix |
| 270 | # define INT64_C(v) __int_c(v, __int64_c_suffix) |
| 271 | # define UINT64_C(v) __uint_c(v, __int64_c_suffix) |
| 272 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 273 | # define INT64_C(v) v |
| 274 | # define UINT64_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 275 | # endif /* __int64_c_suffix */ |
| 276 | #endif /* __int_least64_t */ |
| 277 | |
| 278 | |
| 279 | #ifdef __INT56_TYPE__ |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 280 | # ifdef __INT56_C_SUFFIX__ |
| 281 | # define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__) |
| 282 | # define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__) |
| 283 | # define __int32_c_suffix __INT56_C_SUFFIX__ |
| 284 | # define __int16_c_suffix __INT56_C_SUFFIX__ |
| 285 | # define __int8_c_suffix __INT56_C_SUFFIX__ |
| 286 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 287 | # define INT56_C(v) v |
| 288 | # define UINT56_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 289 | # undef __int32_c_suffix |
| 290 | # undef __int16_c_suffix |
| 291 | # undef __int8_c_suffix |
| 292 | # endif /* __INT56_C_SUFFIX__ */ |
| 293 | #endif /* __INT56_TYPE__ */ |
| 294 | |
| 295 | |
| 296 | #ifdef __INT48_TYPE__ |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 297 | # ifdef __INT48_C_SUFFIX__ |
| 298 | # define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__) |
| 299 | # define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__) |
| 300 | # define __int32_c_suffix __INT48_C_SUFFIX__ |
| 301 | # define __int16_c_suffix __INT48_C_SUFFIX__ |
| 302 | # define __int8_c_suffix __INT48_C_SUFFIX__ |
| 303 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 304 | # define INT48_C(v) v |
| 305 | # define UINT48_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 306 | # undef __int32_c_suffix |
| 307 | # undef __int16_c_suffix |
| 308 | # undef __int8_c_suffix |
| 309 | # endif /* __INT48_C_SUFFIX__ */ |
| 310 | #endif /* __INT48_TYPE__ */ |
| 311 | |
| 312 | |
| 313 | #ifdef __INT40_TYPE__ |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 314 | # ifdef __INT40_C_SUFFIX__ |
| 315 | # define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__) |
| 316 | # define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__) |
| 317 | # define __int32_c_suffix __INT40_C_SUFFIX__ |
| 318 | # define __int16_c_suffix __INT40_C_SUFFIX__ |
| 319 | # define __int8_c_suffix __INT40_C_SUFFIX__ |
| 320 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 321 | # define INT40_C(v) v |
| 322 | # define UINT40_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 323 | # undef __int32_c_suffix |
| 324 | # undef __int16_c_suffix |
| 325 | # undef __int8_c_suffix |
| 326 | # endif /* __INT40_C_SUFFIX__ */ |
| 327 | #endif /* __INT40_TYPE__ */ |
| 328 | |
| 329 | |
| 330 | #ifdef __INT32_TYPE__ |
| 331 | # ifdef __INT32_C_SUFFIX__ |
| 332 | # define __int32_c_suffix __INT32_C_SUFFIX__ |
| 333 | # define __int16_c_suffix __INT32_C_SUFFIX__ |
| 334 | # define __int8_c_suffix __INT32_C_SUFFIX__ |
| 335 | #else |
| 336 | # undef __int32_c_suffix |
| 337 | # undef __int16_c_suffix |
| 338 | # undef __int8_c_suffix |
| 339 | # endif /* __INT32_C_SUFFIX__ */ |
| 340 | #endif /* __INT32_TYPE__ */ |
| 341 | |
| 342 | #ifdef __int_least32_t |
| 343 | # ifdef __int32_c_suffix |
| 344 | # define INT32_C(v) __int_c(v, __int32_c_suffix) |
| 345 | # define UINT32_C(v) __uint_c(v, __int32_c_suffix) |
| 346 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 347 | # define INT32_C(v) v |
| 348 | # define UINT32_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 349 | # endif /* __int32_c_suffix */ |
| 350 | #endif /* __int_least32_t */ |
| 351 | |
| 352 | |
| 353 | #ifdef __INT24_TYPE__ |
| 354 | # ifdef __INT24_C_SUFFIX__ |
| 355 | # define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__) |
| 356 | # define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__) |
| 357 | # define __int16_c_suffix __INT24_C_SUFFIX__ |
| 358 | # define __int8_c_suffix __INT24_C_SUFFIX__ |
| 359 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 360 | # define INT24_C(v) v |
| 361 | # define UINT24_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 362 | # undef __int16_c_suffix |
| 363 | # undef __int8_c_suffix |
| 364 | # endif /* __INT24_C_SUFFIX__ */ |
| 365 | #endif /* __INT24_TYPE__ */ |
| 366 | |
| 367 | |
| 368 | #ifdef __INT16_TYPE__ |
| 369 | # ifdef __INT16_C_SUFFIX__ |
| 370 | # define __int16_c_suffix __INT16_C_SUFFIX__ |
| 371 | # define __int8_c_suffix __INT16_C_SUFFIX__ |
| 372 | #else |
| 373 | # undef __int16_c_suffix |
| 374 | # undef __int8_c_suffix |
| 375 | # endif /* __INT16_C_SUFFIX__ */ |
| 376 | #endif /* __INT16_TYPE__ */ |
| 377 | |
| 378 | #ifdef __int_least16_t |
| 379 | # ifdef __int16_c_suffix |
| 380 | # define INT16_C(v) __int_c(v, __int16_c_suffix) |
| 381 | # define UINT16_C(v) __uint_c(v, __int16_c_suffix) |
| 382 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 383 | # define INT16_C(v) v |
| 384 | # define UINT16_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 385 | # endif /* __int16_c_suffix */ |
| 386 | #endif /* __int_least16_t */ |
| 387 | |
| 388 | |
| 389 | #ifdef __INT8_TYPE__ |
| 390 | # ifdef __INT8_C_SUFFIX__ |
| 391 | # define __int8_c_suffix __INT8_C_SUFFIX__ |
| 392 | #else |
| 393 | # undef __int8_c_suffix |
| 394 | # endif /* __INT8_C_SUFFIX__ */ |
| 395 | #endif /* __INT8_TYPE__ */ |
| 396 | |
| 397 | #ifdef __int_least8_t |
| 398 | # ifdef __int8_c_suffix |
| 399 | # define INT8_C(v) __int_c(v, __int8_c_suffix) |
| 400 | # define UINT8_C(v) __uint_c(v, __int8_c_suffix) |
| 401 | # else |
Ken Dyck | 6ab25f4 | 2009-11-17 13:54:02 +0000 | [diff] [blame] | 402 | # define INT8_C(v) v |
| 403 | # define UINT8_C(v) v ## U |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 404 | # endif /* __int8_c_suffix */ |
| 405 | #endif /* __int_least8_t */ |
| 406 | |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 407 | |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 408 | /* C99 7.18.2.1 Limits of exact-width integer types. |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 409 | * C99 7.18.2.2 Limits of minimum-width integer types. |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 410 | * C99 7.18.2.3 Limits of fastest minimum-width integer types. |
Chris Lattner | 6148428 | 2009-02-07 22:21:31 +0000 | [diff] [blame] | 411 | * |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 412 | * The presence of limit macros are completely optional in C99. This |
| 413 | * implementation defines limits for all of the types (exact- and |
| 414 | * minimum-width) that it defines above, using the limits of the minimum-width |
| 415 | * type for any types that do not have exact-width representations. |
| 416 | * |
| 417 | * As in the type definitions, this section takes an approach of |
| 418 | * successive-shrinking to determine which limits to use for the standard (8, |
| 419 | * 16, 32, 64) bit widths when they don't have exact representations. It is |
| 420 | * therefore important that the defintions be kept in order of decending |
| 421 | * widths. |
| 422 | * |
Chris Lattner | 6148428 | 2009-02-07 22:21:31 +0000 | [diff] [blame] | 423 | * Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the |
| 424 | * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]). |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 425 | */ |
| 426 | |
Chris Lattner | ab775f6 | 2009-02-28 18:53:33 +0000 | [diff] [blame] | 427 | #ifdef __INT64_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 428 | # define INT64_MAX INT64_C( 9223372036854775807) |
| 429 | # define INT64_MIN (-INT64_C( 9223372036854775807)-1) |
| 430 | # define UINT64_MAX UINT64_C(18446744073709551615) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 431 | # define __INT_LEAST64_MIN INT64_MIN |
| 432 | # define __INT_LEAST64_MAX INT64_MAX |
| 433 | # define __UINT_LEAST64_MAX UINT64_MAX |
| 434 | # define __INT_LEAST32_MIN INT64_MIN |
| 435 | # define __INT_LEAST32_MAX INT64_MAX |
| 436 | # define __UINT_LEAST32_MAX UINT64_MAX |
| 437 | # define __INT_LEAST16_MIN INT64_MIN |
| 438 | # define __INT_LEAST16_MAX INT64_MAX |
| 439 | # define __UINT_LEAST16_MAX UINT64_MAX |
| 440 | # define __INT_LEAST8_MIN INT64_MIN |
| 441 | # define __INT_LEAST8_MAX INT64_MAX |
| 442 | # define __UINT_LEAST8_MAX UINT64_MAX |
| 443 | #endif /* __INT64_TYPE__ */ |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 444 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 445 | #ifdef __INT_LEAST64_MIN |
| 446 | # define INT_LEAST64_MIN __INT_LEAST64_MIN |
| 447 | # define INT_LEAST64_MAX __INT_LEAST64_MAX |
| 448 | # define UINT_LEAST64_MAX __UINT_LEAST64_MAX |
| 449 | # define INT_FAST64_MIN __INT_LEAST64_MIN |
| 450 | # define INT_FAST64_MAX __INT_LEAST64_MAX |
| 451 | # define UINT_FAST64_MAX __UINT_LEAST64_MAX |
| 452 | #endif /* __INT_LEAST64_MIN */ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 453 | |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 454 | |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 455 | #ifdef __INT56_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 456 | # define INT56_MAX INT56_C(36028797018963967) |
| 457 | # define INT56_MIN (-INT56_C(36028797018963967)-1) |
| 458 | # define UINT56_MAX UINT56_C(72057594037927935) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 459 | # define INT_LEAST56_MIN INT56_MIN |
| 460 | # define INT_LEAST56_MAX INT56_MAX |
| 461 | # define UINT_LEAST56_MAX UINT56_MAX |
| 462 | # define INT_FAST56_MIN INT56_MIN |
| 463 | # define INT_FAST56_MAX INT56_MAX |
| 464 | # define UINT_FAST56_MAX UINT56_MAX |
| 465 | # define __INT_LEAST32_MIN INT56_MIN |
| 466 | # define __INT_LEAST32_MAX INT56_MAX |
| 467 | # define __UINT_LEAST32_MAX UINT56_MAX |
| 468 | # define __INT_LEAST16_MIN INT56_MIN |
| 469 | # define __INT_LEAST16_MAX INT56_MAX |
| 470 | # define __UINT_LEAST16_MAX UINT56_MAX |
| 471 | # define __INT_LEAST8_MIN INT56_MIN |
| 472 | # define __INT_LEAST8_MAX INT56_MAX |
| 473 | # define __UINT_LEAST8_MAX UINT56_MAX |
| 474 | #endif /* __INT56_TYPE__ */ |
| 475 | |
| 476 | |
| 477 | #ifdef __INT48_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 478 | # define INT48_MAX INT48_C(140737488355327) |
| 479 | # define INT48_MIN (-INT48_C(140737488355327)-1) |
| 480 | # define UINT48_MAX UINT48_C(281474976710655) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 481 | # define INT_LEAST48_MIN INT48_MIN |
| 482 | # define INT_LEAST48_MAX INT48_MAX |
| 483 | # define UINT_LEAST48_MAX UINT48_MAX |
| 484 | # define INT_FAST48_MIN INT48_MIN |
| 485 | # define INT_FAST48_MAX INT48_MAX |
| 486 | # define UINT_FAST48_MAX UINT48_MAX |
| 487 | # define __INT_LEAST32_MIN INT48_MIN |
| 488 | # define __INT_LEAST32_MAX INT48_MAX |
| 489 | # define __UINT_LEAST32_MAX UINT48_MAX |
| 490 | # define __INT_LEAST16_MIN INT48_MIN |
| 491 | # define __INT_LEAST16_MAX INT48_MAX |
| 492 | # define __UINT_LEAST16_MAX UINT48_MAX |
| 493 | # define __INT_LEAST8_MIN INT48_MIN |
| 494 | # define __INT_LEAST8_MAX INT48_MAX |
| 495 | # define __UINT_LEAST8_MAX UINT48_MAX |
| 496 | #endif /* __INT48_TYPE__ */ |
| 497 | |
| 498 | |
| 499 | #ifdef __INT40_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 500 | # define INT40_MAX INT40_C(549755813887) |
| 501 | # define INT40_MIN (-INT40_C(549755813887)-1) |
| 502 | # define UINT40_MAX UINT40_C(1099511627775) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 503 | # define INT_LEAST40_MIN INT40_MIN |
| 504 | # define INT_LEAST40_MAX INT40_MAX |
| 505 | # define UINT_LEAST40_MAX UINT40_MAX |
| 506 | # define INT_FAST40_MIN INT40_MIN |
| 507 | # define INT_FAST40_MAX INT40_MAX |
| 508 | # define UINT_FAST40_MAX UINT40_MAX |
| 509 | # define __INT_LEAST32_MIN INT40_MIN |
| 510 | # define __INT_LEAST32_MAX INT40_MAX |
| 511 | # define __UINT_LEAST32_MAX UINT40_MAX |
| 512 | # define __INT_LEAST16_MIN INT40_MIN |
| 513 | # define __INT_LEAST16_MAX INT40_MAX |
| 514 | # define __UINT_LEAST16_MAX UINT40_MAX |
| 515 | # define __INT_LEAST8_MIN INT40_MIN |
| 516 | # define __INT_LEAST8_MAX INT40_MAX |
| 517 | # define __UINT_LEAST8_MAX UINT40_MAX |
| 518 | #endif /* __INT40_TYPE__ */ |
| 519 | |
| 520 | |
| 521 | #ifdef __INT32_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 522 | # define INT32_MAX INT32_C(2147483647) |
| 523 | # define INT32_MIN (-INT32_C(2147483647)-1) |
| 524 | # define UINT32_MAX UINT32_C(4294967295) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 525 | # define __INT_LEAST32_MIN INT32_MIN |
| 526 | # define __INT_LEAST32_MAX INT32_MAX |
| 527 | # define __UINT_LEAST32_MAX UINT32_MAX |
| 528 | # define __INT_LEAST16_MIN INT32_MIN |
| 529 | # define __INT_LEAST16_MAX INT32_MAX |
| 530 | # define __UINT_LEAST16_MAX UINT32_MAX |
| 531 | # define __INT_LEAST8_MIN INT32_MIN |
| 532 | # define __INT_LEAST8_MAX INT32_MAX |
| 533 | # define __UINT_LEAST8_MAX UINT32_MAX |
| 534 | #endif /* __INT32_TYPE__ */ |
| 535 | |
| 536 | #ifdef __INT_LEAST32_MIN |
| 537 | # define INT_LEAST32_MIN __INT_LEAST32_MIN |
| 538 | # define INT_LEAST32_MAX __INT_LEAST32_MAX |
| 539 | # define UINT_LEAST32_MAX __UINT_LEAST32_MAX |
| 540 | # define INT_FAST32_MIN __INT_LEAST32_MIN |
| 541 | # define INT_FAST32_MAX __INT_LEAST32_MAX |
| 542 | # define UINT_FAST32_MAX __UINT_LEAST32_MAX |
| 543 | #endif /* __INT_LEAST32_MIN */ |
| 544 | |
| 545 | |
| 546 | #ifdef __INT24_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 547 | # define INT24_MAX INT24_C(8388607) |
Ken Dyck | b088756 | 2009-11-17 18:29:12 +0000 | [diff] [blame] | 548 | # define INT24_MIN (-INT24_C(8388607)-1) |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 549 | # define UINT24_MAX UINT24_C(16777215) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 550 | # define INT_LEAST24_MIN INT24_MIN |
| 551 | # define INT_LEAST24_MAX INT24_MAX |
| 552 | # define UINT_LEAST24_MAX UINT24_MAX |
| 553 | # define INT_FAST24_MIN INT24_MIN |
| 554 | # define INT_FAST24_MAX INT24_MAX |
| 555 | # define UINT_FAST24_MAX UINT24_MAX |
| 556 | # define __INT_LEAST16_MIN INT24_MIN |
| 557 | # define __INT_LEAST16_MAX INT24_MAX |
| 558 | # define __UINT_LEAST16_MAX UINT24_MAX |
| 559 | # define __INT_LEAST8_MIN INT24_MIN |
| 560 | # define __INT_LEAST8_MAX INT24_MAX |
| 561 | # define __UINT_LEAST8_MAX UINT24_MAX |
| 562 | #endif /* __INT24_TYPE__ */ |
| 563 | |
| 564 | |
| 565 | #ifdef __INT16_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 566 | #define INT16_MAX INT16_C(32767) |
Ken Dyck | b088756 | 2009-11-17 18:29:12 +0000 | [diff] [blame] | 567 | #define INT16_MIN (-INT16_C(32767)-1) |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 568 | #define UINT16_MAX UINT16_C(65535) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 569 | # define __INT_LEAST16_MIN INT16_MIN |
| 570 | # define __INT_LEAST16_MAX INT16_MAX |
| 571 | # define __UINT_LEAST16_MAX UINT16_MAX |
| 572 | # define __INT_LEAST8_MIN INT16_MIN |
| 573 | # define __INT_LEAST8_MAX INT16_MAX |
| 574 | # define __UINT_LEAST8_MAX UINT16_MAX |
| 575 | #endif /* __INT16_TYPE__ */ |
| 576 | |
| 577 | #ifdef __INT_LEAST16_MIN |
| 578 | # define INT_LEAST16_MIN __INT_LEAST16_MIN |
| 579 | # define INT_LEAST16_MAX __INT_LEAST16_MAX |
| 580 | # define UINT_LEAST16_MAX __UINT_LEAST16_MAX |
| 581 | # define INT_FAST16_MIN __INT_LEAST16_MIN |
| 582 | # define INT_FAST16_MAX __INT_LEAST16_MAX |
| 583 | # define UINT_FAST16_MAX __UINT_LEAST16_MAX |
| 584 | #endif /* __INT_LEAST16_MIN */ |
| 585 | |
| 586 | |
| 587 | #ifdef __INT8_TYPE__ |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 588 | # define INT8_MAX INT8_C(127) |
Ken Dyck | b088756 | 2009-11-17 18:29:12 +0000 | [diff] [blame] | 589 | # define INT8_MIN (-INT8_C(127)-1) |
Ken Dyck | 8163841 | 2009-11-17 16:26:27 +0000 | [diff] [blame] | 590 | # define UINT8_MAX UINT8_C(255) |
Chris Lattner | dcdd2a0 | 2009-11-12 08:08:27 +0000 | [diff] [blame] | 591 | # define __INT_LEAST8_MIN INT8_MIN |
| 592 | # define __INT_LEAST8_MAX INT8_MAX |
| 593 | # define __UINT_LEAST8_MAX UINT8_MAX |
| 594 | #endif /* __INT8_TYPE__ */ |
| 595 | |
| 596 | #ifdef __INT_LEAST8_MIN |
| 597 | # define INT_LEAST8_MIN __INT_LEAST8_MIN |
| 598 | # define INT_LEAST8_MAX __INT_LEAST8_MAX |
| 599 | # define UINT_LEAST8_MAX __UINT_LEAST8_MAX |
| 600 | # define INT_FAST8_MIN __INT_LEAST8_MIN |
| 601 | # define INT_FAST8_MAX __INT_LEAST8_MAX |
| 602 | # define UINT_FAST8_MAX __UINT_LEAST8_MAX |
| 603 | #endif /* __INT_LEAST8_MIN */ |
Chris Lattner | 06dcf6b | 2009-11-04 23:03:18 +0000 | [diff] [blame] | 604 | |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 605 | /* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */ |
| 606 | /* C99 7.18.3 Limits of other integer types. */ |
Ken Dyck | a2e9284 | 2009-11-20 16:44:38 +0000 | [diff] [blame] | 607 | #define __INTN_MIN(n) __stdint_join3( INT, n, _MIN) |
| 608 | #define __INTN_MAX(n) __stdint_join3( INT, n, _MAX) |
| 609 | #define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX) |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 610 | |
Ken Dyck | a2e9284 | 2009-11-20 16:44:38 +0000 | [diff] [blame] | 611 | #define INTPTR_MIN __INTN_MIN(__INTPTR_WIDTH__) |
| 612 | #define INTPTR_MAX __INTN_MAX(__INTPTR_WIDTH__) |
| 613 | #define UINTPTR_MAX __UINTN_MAX(__INTPTR_WIDTH__) |
| 614 | #define PTRDIFF_MIN __INTN_MIN(__PTRDIFF_WIDTH__) |
| 615 | #define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__) |
| 616 | #define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__) |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 617 | |
| 618 | /* C99 7.18.2.5 Limits of greatest-width integer types. */ |
Ken Dyck | a2e9284 | 2009-11-20 16:44:38 +0000 | [diff] [blame] | 619 | #define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__) |
| 620 | #define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__) |
| 621 | #define UINTMAX_MAX __UINTN_MAX(__INTMAX_WIDTH__) |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 622 | |
| 623 | /* C99 7.18.3 Limits of other integer types. */ |
Ken Dyck | fc07d91 | 2009-11-22 15:47:12 +0000 | [diff] [blame] | 624 | #define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__) |
| 625 | #define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__) |
Ken Dyck | a2e9284 | 2009-11-20 16:44:38 +0000 | [diff] [blame] | 626 | #define WINT_MIN __INTN_MIN(__WINT_WIDTH__) |
| 627 | #define WINT_MAX __INTN_MAX(__WINT_WIDTH__) |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 628 | |
| 629 | /* FIXME: if we ever support a target with unsigned wchar_t, this should be |
| 630 | * 0 .. Max. |
| 631 | */ |
| 632 | #ifndef WCHAR_MAX |
Ken Dyck | a2e9284 | 2009-11-20 16:44:38 +0000 | [diff] [blame] | 633 | #define WCHAR_MAX __INTN_MAX(__WCHAR_WIDTH__) |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 634 | #endif |
| 635 | #ifndef WCHAR_MIN |
Ken Dyck | a2e9284 | 2009-11-20 16:44:38 +0000 | [diff] [blame] | 636 | #define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__) |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 637 | #endif |
| 638 | |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 639 | /* 7.18.4.2 Macros for greatest-width integer constants. */ |
Ken Dyck | fdb4324 | 2009-11-20 16:49:10 +0000 | [diff] [blame] | 640 | #define __INTN_C(n, v) __stdint_join3( INT, n, _C(v)) |
| 641 | #define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v)) |
| 642 | |
| 643 | #define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v) |
| 644 | #define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v) |
Chris Lattner | 2a67f7b | 2009-02-06 22:59:47 +0000 | [diff] [blame] | 645 | |
Eli Friedman | 6fdca0e | 2009-05-03 23:00:48 +0000 | [diff] [blame] | 646 | #endif /* __STDC_HOSTED__ */ |
| 647 | #endif /* __CLANG_STDINT_H */ |