clang API Documentation

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