clang API Documentation
00001 /*===---- stdint.h - Standard header for sized integer types --------------===*\ 00002 * 00003 * Copyright (c) 2009 Chris Lattner 00004 * 00005 * Permission is hereby granted, free of charge, to any person obtaining a copy 00006 * of this software and associated documentation files (the "Software"), to deal 00007 * in the Software without restriction, including without limitation the rights 00008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 * copies of the Software, and to permit persons to whom the Software is 00010 * furnished to do so, subject to the following conditions: 00011 * 00012 * The above copyright notice and this permission notice shall be included in 00013 * all copies or substantial portions of the Software. 00014 * 00015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00021 * THE SOFTWARE. 00022 * 00023 \*===----------------------------------------------------------------------===*/ 00024 00025 #ifndef __CLANG_STDINT_H 00026 #define __CLANG_STDINT_H 00027 00028 /* If we're hosted, fall back to the system's stdint.h, which might have 00029 * additional definitions. 00030 */ 00031 #if __STDC_HOSTED__ && __has_include_next(<stdint.h>) 00032 00033 // C99 7.18.3 Limits of other integer types 00034 // 00035 // Footnote 219, 220: C++ implementations should define these macros only when 00036 // __STDC_LIMIT_MACROS is defined before <stdint.h> is included. 00037 // 00038 // Footnote 222: C++ implementations should define these macros only when 00039 // __STDC_CONSTANT_MACROS is defined before <stdint.h> is included. 00040 // 00041 // C++11 [cstdint.syn]p2: 00042 // 00043 // The macros defined by <cstdint> are provided unconditionally. In particular, 00044 // the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in 00045 // footnotes 219, 220, and 222 in the C standard) play no role in C++. 00046 // 00047 // C11 removed the problematic footnotes. 00048 // 00049 // Work around this inconsistency by always defining those macros in C++ mode, 00050 // so that a C library implementation which follows the C99 standard can be 00051 // used in C++. 00052 # ifdef __cplusplus 00053 # if !defined(__STDC_LIMIT_MACROS) 00054 # define __STDC_LIMIT_MACROS 00055 # define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG 00056 # endif 00057 # if !defined(__STDC_CONSTANT_MACROS) 00058 # define __STDC_CONSTANT_MACROS 00059 # define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG 00060 # endif 00061 # endif 00062 00063 # include_next <stdint.h> 00064 00065 # ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG 00066 # undef __STDC_LIMIT_MACROS 00067 # undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG 00068 # endif 00069 # ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG 00070 # undef __STDC_CONSTANT_MACROS 00071 # undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG 00072 # endif 00073 00074 #else 00075 00076 /* C99 7.18.1.1 Exact-width integer types. 00077 * C99 7.18.1.2 Minimum-width integer types. 00078 * C99 7.18.1.3 Fastest minimum-width integer types. 00079 * 00080 * The standard requires that exact-width type be defined for 8-, 16-, 32-, and 00081 * 64-bit types if they are implemented. Other exact width types are optional. 00082 * This implementation defines an exact-width types for every integer width 00083 * that is represented in the standard integer types. 00084 * 00085 * The standard also requires minimum-width types be defined for 8-, 16-, 32-, 00086 * and 64-bit widths regardless of whether there are corresponding exact-width 00087 * types. 00088 * 00089 * To accommodate targets that are missing types that are exactly 8, 16, 32, or 00090 * 64 bits wide, this implementation takes an approach of cascading 00091 * redefintions, redefining __int_leastN_t to successively smaller exact-width 00092 * types. It is therefore important that the types are defined in order of 00093 * descending widths. 00094 * 00095 * We currently assume that the minimum-width types and the fastest 00096 * minimum-width types are the same. This is allowed by the standard, but is 00097 * suboptimal. 00098 * 00099 * In violation of the standard, some targets do not implement a type that is 00100 * wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit). 00101 * To accommodate these targets, a required minimum-width type is only 00102 * defined if there exists an exact-width type of equal or greater width. 00103 */ 00104 00105 #ifdef __INT64_TYPE__ 00106 # ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/ 00107 typedef __INT64_TYPE__ int64_t; 00108 # endif /* __int8_t_defined */ 00109 typedef __UINT64_TYPE__ uint64_t; 00110 # define __int_least64_t int64_t 00111 # define __uint_least64_t uint64_t 00112 # define __int_least32_t int64_t 00113 # define __uint_least32_t uint64_t 00114 # define __int_least16_t int64_t 00115 # define __uint_least16_t uint64_t 00116 # define __int_least8_t int64_t 00117 # define __uint_least8_t uint64_t 00118 #endif /* __INT64_TYPE__ */ 00119 00120 #ifdef __int_least64_t 00121 typedef __int_least64_t int_least64_t; 00122 typedef __uint_least64_t uint_least64_t; 00123 typedef __int_least64_t int_fast64_t; 00124 typedef __uint_least64_t uint_fast64_t; 00125 #endif /* __int_least64_t */ 00126 00127 #ifdef __INT56_TYPE__ 00128 typedef __INT56_TYPE__ int56_t; 00129 typedef __UINT56_TYPE__ uint56_t; 00130 typedef int56_t int_least56_t; 00131 typedef uint56_t uint_least56_t; 00132 typedef int56_t int_fast56_t; 00133 typedef uint56_t uint_fast56_t; 00134 # define __int_least32_t int56_t 00135 # define __uint_least32_t uint56_t 00136 # define __int_least16_t int56_t 00137 # define __uint_least16_t uint56_t 00138 # define __int_least8_t int56_t 00139 # define __uint_least8_t uint56_t 00140 #endif /* __INT56_TYPE__ */ 00141 00142 00143 #ifdef __INT48_TYPE__ 00144 typedef __INT48_TYPE__ int48_t; 00145 typedef __UINT48_TYPE__ uint48_t; 00146 typedef int48_t int_least48_t; 00147 typedef uint48_t uint_least48_t; 00148 typedef int48_t int_fast48_t; 00149 typedef uint48_t uint_fast48_t; 00150 # define __int_least32_t int48_t 00151 # define __uint_least32_t uint48_t 00152 # define __int_least16_t int48_t 00153 # define __uint_least16_t uint48_t 00154 # define __int_least8_t int48_t 00155 # define __uint_least8_t uint48_t 00156 #endif /* __INT48_TYPE__ */ 00157 00158 00159 #ifdef __INT40_TYPE__ 00160 typedef __INT40_TYPE__ int40_t; 00161 typedef __UINT40_TYPE__ uint40_t; 00162 typedef int40_t int_least40_t; 00163 typedef uint40_t uint_least40_t; 00164 typedef int40_t int_fast40_t; 00165 typedef uint40_t uint_fast40_t; 00166 # define __int_least32_t int40_t 00167 # define __uint_least32_t uint40_t 00168 # define __int_least16_t int40_t 00169 # define __uint_least16_t uint40_t 00170 # define __int_least8_t int40_t 00171 # define __uint_least8_t uint40_t 00172 #endif /* __INT40_TYPE__ */ 00173 00174 00175 #ifdef __INT32_TYPE__ 00176 00177 # ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/ 00178 typedef __INT32_TYPE__ int32_t; 00179 # endif /* __int8_t_defined */ 00180 00181 # ifndef __uint32_t_defined /* more glibc compatibility */ 00182 # define __uint32_t_defined 00183 typedef __UINT32_TYPE__ uint32_t; 00184 # endif /* __uint32_t_defined */ 00185 00186 # define __int_least32_t int32_t 00187 # define __uint_least32_t uint32_t 00188 # define __int_least16_t int32_t 00189 # define __uint_least16_t uint32_t 00190 # define __int_least8_t int32_t 00191 # define __uint_least8_t uint32_t 00192 #endif /* __INT32_TYPE__ */ 00193 00194 #ifdef __int_least32_t 00195 typedef __int_least32_t int_least32_t; 00196 typedef __uint_least32_t uint_least32_t; 00197 typedef __int_least32_t int_fast32_t; 00198 typedef __uint_least32_t uint_fast32_t; 00199 #endif /* __int_least32_t */ 00200 00201 #ifdef __INT24_TYPE__ 00202 typedef __INT24_TYPE__ int24_t; 00203 typedef __UINT24_TYPE__ uint24_t; 00204 typedef int24_t int_least24_t; 00205 typedef uint24_t uint_least24_t; 00206 typedef int24_t int_fast24_t; 00207 typedef uint24_t uint_fast24_t; 00208 # define __int_least16_t int24_t 00209 # define __uint_least16_t uint24_t 00210 # define __int_least8_t int24_t 00211 # define __uint_least8_t uint24_t 00212 #endif /* __INT24_TYPE__ */ 00213 00214 #ifdef __INT16_TYPE__ 00215 #ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/ 00216 typedef __INT16_TYPE__ int16_t; 00217 #endif /* __int8_t_defined */ 00218 typedef __UINT16_TYPE__ uint16_t; 00219 # define __int_least16_t int16_t 00220 # define __uint_least16_t uint16_t 00221 # define __int_least8_t int16_t 00222 # define __uint_least8_t uint16_t 00223 #endif /* __INT16_TYPE__ */ 00224 00225 #ifdef __int_least16_t 00226 typedef __int_least16_t int_least16_t; 00227 typedef __uint_least16_t uint_least16_t; 00228 typedef __int_least16_t int_fast16_t; 00229 typedef __uint_least16_t uint_fast16_t; 00230 #endif /* __int_least16_t */ 00231 00232 00233 #ifdef __INT8_TYPE__ 00234 #ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/ 00235 typedef __INT8_TYPE__ int8_t; 00236 #endif /* __int8_t_defined */ 00237 typedef __UINT8_TYPE__ uint8_t; 00238 # define __int_least8_t int8_t 00239 # define __uint_least8_t uint8_t 00240 #endif /* __INT8_TYPE__ */ 00241 00242 #ifdef __int_least8_t 00243 typedef __int_least8_t int_least8_t; 00244 typedef __uint_least8_t uint_least8_t; 00245 typedef __int_least8_t int_fast8_t; 00246 typedef __uint_least8_t uint_fast8_t; 00247 #endif /* __int_least8_t */ 00248 00249 /* prevent glibc sys/types.h from defining conflicting types */ 00250 #ifndef __int8_t_defined 00251 # define __int8_t_defined 00252 #endif /* __int8_t_defined */ 00253 00254 /* C99 7.18.1.4 Integer types capable of holding object pointers. 00255 */ 00256 #define __stdint_join3(a,b,c) a ## b ## c 00257 00258 #define __intn_t(n) __stdint_join3( int, n, _t) 00259 #define __uintn_t(n) __stdint_join3(uint, n, _t) 00260 00261 #ifndef _INTPTR_T 00262 #ifndef __intptr_t_defined 00263 typedef __intn_t(__INTPTR_WIDTH__) intptr_t; 00264 #define __intptr_t_defined 00265 #define _INTPTR_T 00266 #endif 00267 #endif 00268 00269 #ifndef _UINTPTR_T 00270 typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t; 00271 #define _UINTPTR_T 00272 #endif 00273 00274 /* C99 7.18.1.5 Greatest-width integer types. 00275 */ 00276 typedef __INTMAX_TYPE__ intmax_t; 00277 typedef __UINTMAX_TYPE__ uintmax_t; 00278 00279 /* C99 7.18.4 Macros for minimum-width integer constants. 00280 * 00281 * The standard requires that integer constant macros be defined for all the 00282 * minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width 00283 * types are required, the corresponding integer constant macros are defined 00284 * here. This implementation also defines minimum-width types for every other 00285 * integer width that the target implements, so corresponding macros are 00286 * defined below, too. 00287 * 00288 * These macros are defined using the same successive-shrinking approach as 00289 * the type definitions above. It is likewise important that macros are defined 00290 * in order of decending width. 00291 * 00292 * Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the 00293 * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]). 00294 */ 00295 00296 #define __int_c_join(a, b) a ## b 00297 #define __int_c(v, suffix) __int_c_join(v, suffix) 00298 #define __uint_c(v, suffix) __int_c_join(v##U, suffix) 00299 00300 00301 #ifdef __INT64_TYPE__ 00302 # ifdef __INT64_C_SUFFIX__ 00303 # define __int64_c_suffix __INT64_C_SUFFIX__ 00304 # define __int32_c_suffix __INT64_C_SUFFIX__ 00305 # define __int16_c_suffix __INT64_C_SUFFIX__ 00306 # define __int8_c_suffix __INT64_C_SUFFIX__ 00307 # else 00308 # undef __int64_c_suffix 00309 # undef __int32_c_suffix 00310 # undef __int16_c_suffix 00311 # undef __int8_c_suffix 00312 # endif /* __INT64_C_SUFFIX__ */ 00313 #endif /* __INT64_TYPE__ */ 00314 00315 #ifdef __int_least64_t 00316 # ifdef __int64_c_suffix 00317 # define INT64_C(v) __int_c(v, __int64_c_suffix) 00318 # define UINT64_C(v) __uint_c(v, __int64_c_suffix) 00319 # else 00320 # define INT64_C(v) v 00321 # define UINT64_C(v) v ## U 00322 # endif /* __int64_c_suffix */ 00323 #endif /* __int_least64_t */ 00324 00325 00326 #ifdef __INT56_TYPE__ 00327 # ifdef __INT56_C_SUFFIX__ 00328 # define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__) 00329 # define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__) 00330 # define __int32_c_suffix __INT56_C_SUFFIX__ 00331 # define __int16_c_suffix __INT56_C_SUFFIX__ 00332 # define __int8_c_suffix __INT56_C_SUFFIX__ 00333 # else 00334 # define INT56_C(v) v 00335 # define UINT56_C(v) v ## U 00336 # undef __int32_c_suffix 00337 # undef __int16_c_suffix 00338 # undef __int8_c_suffix 00339 # endif /* __INT56_C_SUFFIX__ */ 00340 #endif /* __INT56_TYPE__ */ 00341 00342 00343 #ifdef __INT48_TYPE__ 00344 # ifdef __INT48_C_SUFFIX__ 00345 # define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__) 00346 # define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__) 00347 # define __int32_c_suffix __INT48_C_SUFFIX__ 00348 # define __int16_c_suffix __INT48_C_SUFFIX__ 00349 # define __int8_c_suffix __INT48_C_SUFFIX__ 00350 # else 00351 # define INT48_C(v) v 00352 # define UINT48_C(v) v ## U 00353 # undef __int32_c_suffix 00354 # undef __int16_c_suffix 00355 # undef __int8_c_suffix 00356 # endif /* __INT48_C_SUFFIX__ */ 00357 #endif /* __INT48_TYPE__ */ 00358 00359 00360 #ifdef __INT40_TYPE__ 00361 # ifdef __INT40_C_SUFFIX__ 00362 # define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__) 00363 # define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__) 00364 # define __int32_c_suffix __INT40_C_SUFFIX__ 00365 # define __int16_c_suffix __INT40_C_SUFFIX__ 00366 # define __int8_c_suffix __INT40_C_SUFFIX__ 00367 # else 00368 # define INT40_C(v) v 00369 # define UINT40_C(v) v ## U 00370 # undef __int32_c_suffix 00371 # undef __int16_c_suffix 00372 # undef __int8_c_suffix 00373 # endif /* __INT40_C_SUFFIX__ */ 00374 #endif /* __INT40_TYPE__ */ 00375 00376 00377 #ifdef __INT32_TYPE__ 00378 # ifdef __INT32_C_SUFFIX__ 00379 # define __int32_c_suffix __INT32_C_SUFFIX__ 00380 # define __int16_c_suffix __INT32_C_SUFFIX__ 00381 # define __int8_c_suffix __INT32_C_SUFFIX__ 00382 #else 00383 # undef __int32_c_suffix 00384 # undef __int16_c_suffix 00385 # undef __int8_c_suffix 00386 # endif /* __INT32_C_SUFFIX__ */ 00387 #endif /* __INT32_TYPE__ */ 00388 00389 #ifdef __int_least32_t 00390 # ifdef __int32_c_suffix 00391 # define INT32_C(v) __int_c(v, __int32_c_suffix) 00392 # define UINT32_C(v) __uint_c(v, __int32_c_suffix) 00393 # else 00394 # define INT32_C(v) v 00395 # define UINT32_C(v) v ## U 00396 # endif /* __int32_c_suffix */ 00397 #endif /* __int_least32_t */ 00398 00399 00400 #ifdef __INT24_TYPE__ 00401 # ifdef __INT24_C_SUFFIX__ 00402 # define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__) 00403 # define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__) 00404 # define __int16_c_suffix __INT24_C_SUFFIX__ 00405 # define __int8_c_suffix __INT24_C_SUFFIX__ 00406 # else 00407 # define INT24_C(v) v 00408 # define UINT24_C(v) v ## U 00409 # undef __int16_c_suffix 00410 # undef __int8_c_suffix 00411 # endif /* __INT24_C_SUFFIX__ */ 00412 #endif /* __INT24_TYPE__ */ 00413 00414 00415 #ifdef __INT16_TYPE__ 00416 # ifdef __INT16_C_SUFFIX__ 00417 # define __int16_c_suffix __INT16_C_SUFFIX__ 00418 # define __int8_c_suffix __INT16_C_SUFFIX__ 00419 #else 00420 # undef __int16_c_suffix 00421 # undef __int8_c_suffix 00422 # endif /* __INT16_C_SUFFIX__ */ 00423 #endif /* __INT16_TYPE__ */ 00424 00425 #ifdef __int_least16_t 00426 # ifdef __int16_c_suffix 00427 # define INT16_C(v) __int_c(v, __int16_c_suffix) 00428 # define UINT16_C(v) __uint_c(v, __int16_c_suffix) 00429 # else 00430 # define INT16_C(v) v 00431 # define UINT16_C(v) v ## U 00432 # endif /* __int16_c_suffix */ 00433 #endif /* __int_least16_t */ 00434 00435 00436 #ifdef __INT8_TYPE__ 00437 # ifdef __INT8_C_SUFFIX__ 00438 # define __int8_c_suffix __INT8_C_SUFFIX__ 00439 #else 00440 # undef __int8_c_suffix 00441 # endif /* __INT8_C_SUFFIX__ */ 00442 #endif /* __INT8_TYPE__ */ 00443 00444 #ifdef __int_least8_t 00445 # ifdef __int8_c_suffix 00446 # define INT8_C(v) __int_c(v, __int8_c_suffix) 00447 # define UINT8_C(v) __uint_c(v, __int8_c_suffix) 00448 # else 00449 # define INT8_C(v) v 00450 # define UINT8_C(v) v ## U 00451 # endif /* __int8_c_suffix */ 00452 #endif /* __int_least8_t */ 00453 00454 00455 /* C99 7.18.2.1 Limits of exact-width integer types. 00456 * C99 7.18.2.2 Limits of minimum-width integer types. 00457 * C99 7.18.2.3 Limits of fastest minimum-width integer types. 00458 * 00459 * The presence of limit macros are completely optional in C99. This 00460 * implementation defines limits for all of the types (exact- and 00461 * minimum-width) that it defines above, using the limits of the minimum-width 00462 * type for any types that do not have exact-width representations. 00463 * 00464 * As in the type definitions, this section takes an approach of 00465 * successive-shrinking to determine which limits to use for the standard (8, 00466 * 16, 32, 64) bit widths when they don't have exact representations. It is 00467 * therefore important that the defintions be kept in order of decending 00468 * widths. 00469 * 00470 * Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the 00471 * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]). 00472 */ 00473 00474 #ifdef __INT64_TYPE__ 00475 # define INT64_MAX INT64_C( 9223372036854775807) 00476 # define INT64_MIN (-INT64_C( 9223372036854775807)-1) 00477 # define UINT64_MAX UINT64_C(18446744073709551615) 00478 # define __INT_LEAST64_MIN INT64_MIN 00479 # define __INT_LEAST64_MAX INT64_MAX 00480 # define __UINT_LEAST64_MAX UINT64_MAX 00481 # define __INT_LEAST32_MIN INT64_MIN 00482 # define __INT_LEAST32_MAX INT64_MAX 00483 # define __UINT_LEAST32_MAX UINT64_MAX 00484 # define __INT_LEAST16_MIN INT64_MIN 00485 # define __INT_LEAST16_MAX INT64_MAX 00486 # define __UINT_LEAST16_MAX UINT64_MAX 00487 # define __INT_LEAST8_MIN INT64_MIN 00488 # define __INT_LEAST8_MAX INT64_MAX 00489 # define __UINT_LEAST8_MAX UINT64_MAX 00490 #endif /* __INT64_TYPE__ */ 00491 00492 #ifdef __INT_LEAST64_MIN 00493 # define INT_LEAST64_MIN __INT_LEAST64_MIN 00494 # define INT_LEAST64_MAX __INT_LEAST64_MAX 00495 # define UINT_LEAST64_MAX __UINT_LEAST64_MAX 00496 # define INT_FAST64_MIN __INT_LEAST64_MIN 00497 # define INT_FAST64_MAX __INT_LEAST64_MAX 00498 # define UINT_FAST64_MAX __UINT_LEAST64_MAX 00499 #endif /* __INT_LEAST64_MIN */ 00500 00501 00502 #ifdef __INT56_TYPE__ 00503 # define INT56_MAX INT56_C(36028797018963967) 00504 # define INT56_MIN (-INT56_C(36028797018963967)-1) 00505 # define UINT56_MAX UINT56_C(72057594037927935) 00506 # define INT_LEAST56_MIN INT56_MIN 00507 # define INT_LEAST56_MAX INT56_MAX 00508 # define UINT_LEAST56_MAX UINT56_MAX 00509 # define INT_FAST56_MIN INT56_MIN 00510 # define INT_FAST56_MAX INT56_MAX 00511 # define UINT_FAST56_MAX UINT56_MAX 00512 # define __INT_LEAST32_MIN INT56_MIN 00513 # define __INT_LEAST32_MAX INT56_MAX 00514 # define __UINT_LEAST32_MAX UINT56_MAX 00515 # define __INT_LEAST16_MIN INT56_MIN 00516 # define __INT_LEAST16_MAX INT56_MAX 00517 # define __UINT_LEAST16_MAX UINT56_MAX 00518 # define __INT_LEAST8_MIN INT56_MIN 00519 # define __INT_LEAST8_MAX INT56_MAX 00520 # define __UINT_LEAST8_MAX UINT56_MAX 00521 #endif /* __INT56_TYPE__ */ 00522 00523 00524 #ifdef __INT48_TYPE__ 00525 # define INT48_MAX INT48_C(140737488355327) 00526 # define INT48_MIN (-INT48_C(140737488355327)-1) 00527 # define UINT48_MAX UINT48_C(281474976710655) 00528 # define INT_LEAST48_MIN INT48_MIN 00529 # define INT_LEAST48_MAX INT48_MAX 00530 # define UINT_LEAST48_MAX UINT48_MAX 00531 # define INT_FAST48_MIN INT48_MIN 00532 # define INT_FAST48_MAX INT48_MAX 00533 # define UINT_FAST48_MAX UINT48_MAX 00534 # define __INT_LEAST32_MIN INT48_MIN 00535 # define __INT_LEAST32_MAX INT48_MAX 00536 # define __UINT_LEAST32_MAX UINT48_MAX 00537 # define __INT_LEAST16_MIN INT48_MIN 00538 # define __INT_LEAST16_MAX INT48_MAX 00539 # define __UINT_LEAST16_MAX UINT48_MAX 00540 # define __INT_LEAST8_MIN INT48_MIN 00541 # define __INT_LEAST8_MAX INT48_MAX 00542 # define __UINT_LEAST8_MAX UINT48_MAX 00543 #endif /* __INT48_TYPE__ */ 00544 00545 00546 #ifdef __INT40_TYPE__ 00547 # define INT40_MAX INT40_C(549755813887) 00548 # define INT40_MIN (-INT40_C(549755813887)-1) 00549 # define UINT40_MAX UINT40_C(1099511627775) 00550 # define INT_LEAST40_MIN INT40_MIN 00551 # define INT_LEAST40_MAX INT40_MAX 00552 # define UINT_LEAST40_MAX UINT40_MAX 00553 # define INT_FAST40_MIN INT40_MIN 00554 # define INT_FAST40_MAX INT40_MAX 00555 # define UINT_FAST40_MAX UINT40_MAX 00556 # define __INT_LEAST32_MIN INT40_MIN 00557 # define __INT_LEAST32_MAX INT40_MAX 00558 # define __UINT_LEAST32_MAX UINT40_MAX 00559 # define __INT_LEAST16_MIN INT40_MIN 00560 # define __INT_LEAST16_MAX INT40_MAX 00561 # define __UINT_LEAST16_MAX UINT40_MAX 00562 # define __INT_LEAST8_MIN INT40_MIN 00563 # define __INT_LEAST8_MAX INT40_MAX 00564 # define __UINT_LEAST8_MAX UINT40_MAX 00565 #endif /* __INT40_TYPE__ */ 00566 00567 00568 #ifdef __INT32_TYPE__ 00569 # define INT32_MAX INT32_C(2147483647) 00570 # define INT32_MIN (-INT32_C(2147483647)-1) 00571 # define UINT32_MAX UINT32_C(4294967295) 00572 # define __INT_LEAST32_MIN INT32_MIN 00573 # define __INT_LEAST32_MAX INT32_MAX 00574 # define __UINT_LEAST32_MAX UINT32_MAX 00575 # define __INT_LEAST16_MIN INT32_MIN 00576 # define __INT_LEAST16_MAX INT32_MAX 00577 # define __UINT_LEAST16_MAX UINT32_MAX 00578 # define __INT_LEAST8_MIN INT32_MIN 00579 # define __INT_LEAST8_MAX INT32_MAX 00580 # define __UINT_LEAST8_MAX UINT32_MAX 00581 #endif /* __INT32_TYPE__ */ 00582 00583 #ifdef __INT_LEAST32_MIN 00584 # define INT_LEAST32_MIN __INT_LEAST32_MIN 00585 # define INT_LEAST32_MAX __INT_LEAST32_MAX 00586 # define UINT_LEAST32_MAX __UINT_LEAST32_MAX 00587 # define INT_FAST32_MIN __INT_LEAST32_MIN 00588 # define INT_FAST32_MAX __INT_LEAST32_MAX 00589 # define UINT_FAST32_MAX __UINT_LEAST32_MAX 00590 #endif /* __INT_LEAST32_MIN */ 00591 00592 00593 #ifdef __INT24_TYPE__ 00594 # define INT24_MAX INT24_C(8388607) 00595 # define INT24_MIN (-INT24_C(8388607)-1) 00596 # define UINT24_MAX UINT24_C(16777215) 00597 # define INT_LEAST24_MIN INT24_MIN 00598 # define INT_LEAST24_MAX INT24_MAX 00599 # define UINT_LEAST24_MAX UINT24_MAX 00600 # define INT_FAST24_MIN INT24_MIN 00601 # define INT_FAST24_MAX INT24_MAX 00602 # define UINT_FAST24_MAX UINT24_MAX 00603 # define __INT_LEAST16_MIN INT24_MIN 00604 # define __INT_LEAST16_MAX INT24_MAX 00605 # define __UINT_LEAST16_MAX UINT24_MAX 00606 # define __INT_LEAST8_MIN INT24_MIN 00607 # define __INT_LEAST8_MAX INT24_MAX 00608 # define __UINT_LEAST8_MAX UINT24_MAX 00609 #endif /* __INT24_TYPE__ */ 00610 00611 00612 #ifdef __INT16_TYPE__ 00613 #define INT16_MAX INT16_C(32767) 00614 #define INT16_MIN (-INT16_C(32767)-1) 00615 #define UINT16_MAX UINT16_C(65535) 00616 # define __INT_LEAST16_MIN INT16_MIN 00617 # define __INT_LEAST16_MAX INT16_MAX 00618 # define __UINT_LEAST16_MAX UINT16_MAX 00619 # define __INT_LEAST8_MIN INT16_MIN 00620 # define __INT_LEAST8_MAX INT16_MAX 00621 # define __UINT_LEAST8_MAX UINT16_MAX 00622 #endif /* __INT16_TYPE__ */ 00623 00624 #ifdef __INT_LEAST16_MIN 00625 # define INT_LEAST16_MIN __INT_LEAST16_MIN 00626 # define INT_LEAST16_MAX __INT_LEAST16_MAX 00627 # define UINT_LEAST16_MAX __UINT_LEAST16_MAX 00628 # define INT_FAST16_MIN __INT_LEAST16_MIN 00629 # define INT_FAST16_MAX __INT_LEAST16_MAX 00630 # define UINT_FAST16_MAX __UINT_LEAST16_MAX 00631 #endif /* __INT_LEAST16_MIN */ 00632 00633 00634 #ifdef __INT8_TYPE__ 00635 # define INT8_MAX INT8_C(127) 00636 # define INT8_MIN (-INT8_C(127)-1) 00637 # define UINT8_MAX UINT8_C(255) 00638 # define __INT_LEAST8_MIN INT8_MIN 00639 # define __INT_LEAST8_MAX INT8_MAX 00640 # define __UINT_LEAST8_MAX UINT8_MAX 00641 #endif /* __INT8_TYPE__ */ 00642 00643 #ifdef __INT_LEAST8_MIN 00644 # define INT_LEAST8_MIN __INT_LEAST8_MIN 00645 # define INT_LEAST8_MAX __INT_LEAST8_MAX 00646 # define UINT_LEAST8_MAX __UINT_LEAST8_MAX 00647 # define INT_FAST8_MIN __INT_LEAST8_MIN 00648 # define INT_FAST8_MAX __INT_LEAST8_MAX 00649 # define UINT_FAST8_MAX __UINT_LEAST8_MAX 00650 #endif /* __INT_LEAST8_MIN */ 00651 00652 /* Some utility macros */ 00653 #define __INTN_MIN(n) __stdint_join3( INT, n, _MIN) 00654 #define __INTN_MAX(n) __stdint_join3( INT, n, _MAX) 00655 #define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX) 00656 #define __INTN_C(n, v) __stdint_join3( INT, n, _C(v)) 00657 #define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v)) 00658 00659 /* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */ 00660 /* C99 7.18.3 Limits of other integer types. */ 00661 00662 #define INTPTR_MIN __INTN_MIN(__INTPTR_WIDTH__) 00663 #define INTPTR_MAX __INTN_MAX(__INTPTR_WIDTH__) 00664 #define UINTPTR_MAX __UINTN_MAX(__INTPTR_WIDTH__) 00665 #define PTRDIFF_MIN __INTN_MIN(__PTRDIFF_WIDTH__) 00666 #define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__) 00667 #define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__) 00668 00669 /* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__ 00670 * is enabled. */ 00671 #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 00672 #define RSIZE_MAX (SIZE_MAX >> 1) 00673 #endif 00674 00675 /* C99 7.18.2.5 Limits of greatest-width integer types. */ 00676 #define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__) 00677 #define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__) 00678 #define UINTMAX_MAX __UINTN_MAX(__INTMAX_WIDTH__) 00679 00680 /* C99 7.18.3 Limits of other integer types. */ 00681 #define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__) 00682 #define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__) 00683 #ifdef __WINT_UNSIGNED__ 00684 # define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0) 00685 # define WINT_MAX __UINTN_MAX(__WINT_WIDTH__) 00686 #else 00687 # define WINT_MIN __INTN_MIN(__WINT_WIDTH__) 00688 # define WINT_MAX __INTN_MAX(__WINT_WIDTH__) 00689 #endif 00690 00691 #ifndef WCHAR_MAX 00692 # define WCHAR_MAX __WCHAR_MAX__ 00693 #endif 00694 #ifndef WCHAR_MIN 00695 # if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__) 00696 # define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__) 00697 # else 00698 # define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0) 00699 # endif 00700 #endif 00701 00702 /* 7.18.4.2 Macros for greatest-width integer constants. */ 00703 #define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v) 00704 #define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v) 00705 00706 #endif /* __STDC_HOSTED__ */ 00707 #endif /* __CLANG_STDINT_H */