Ying Wang | 0543663 | 2013-04-05 16:01:00 -0700 | [diff] [blame] | 1 | /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ |
| 2 | /* Copyright (C) 2001-2002, 2004-2012 Free Software Foundation, Inc. |
| 3 | Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. |
| 4 | This file is part of gnulib. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 3, or (at your option) |
| 9 | any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | /* |
| 20 | * ISO C 99 <stdint.h> for platforms that lack it. |
| 21 | * <http://www.opengroup.org/susv3xbd/stdint.h.html> |
| 22 | */ |
| 23 | |
| 24 | #ifndef _GL_STDINT_H |
| 25 | |
| 26 | #if __GNUC__ >= 3 |
| 27 | #pragma GCC system_header |
| 28 | #endif |
| 29 | |
| 30 | |
| 31 | /* When including a system file that in turn includes <inttypes.h>, |
| 32 | use the system <inttypes.h>, not our substitute. This avoids |
| 33 | problems with (for example) VMS, whose <sys/bitypes.h> includes |
| 34 | <inttypes.h>. */ |
| 35 | #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H |
| 36 | |
| 37 | /* On Android (Bionic libc), <sys/types.h> includes this file before |
| 38 | having defined 'time_t'. Therefore in this case avoid including |
| 39 | other system header files; just include the system's <stdint.h>. |
| 40 | Ideally we should test __BIONIC__ here, but it is only defined after |
| 41 | <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */ |
| 42 | #if defined __ANDROID__ \ |
| 43 | && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_ |
| 44 | # include_next <stdint.h> |
| 45 | #else |
| 46 | |
| 47 | /* Get those types that are already defined in other system include |
| 48 | files, so that we can "#define int8_t signed char" below without |
| 49 | worrying about a later system include file containing a "typedef |
| 50 | signed char int8_t;" that will get messed up by our macro. Our |
| 51 | macros should all be consistent with the system versions, except |
| 52 | for the "fast" types and macros, which we recommend against using |
| 53 | in public interfaces due to compiler differences. */ |
| 54 | |
| 55 | #if 1 |
| 56 | # if defined __sgi && ! defined __c99 |
| 57 | /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users |
| 58 | with "This header file is to be used only for c99 mode compilations" |
| 59 | diagnostics. */ |
| 60 | # define __STDINT_H__ |
| 61 | # endif |
| 62 | |
| 63 | /* Some pre-C++11 <stdint.h> implementations need this. */ |
| 64 | # ifdef __cplusplus |
| 65 | # ifndef __STDC_CONSTANT_MACROS |
| 66 | # define __STDC_CONSTANT_MACROS 1 |
| 67 | # endif |
| 68 | # ifndef __STDC_LIMIT_MACROS |
| 69 | # define __STDC_LIMIT_MACROS 1 |
| 70 | # endif |
| 71 | # endif |
| 72 | |
| 73 | /* Other systems may have an incomplete or buggy <stdint.h>. |
| 74 | Include it before <inttypes.h>, since any "#include <stdint.h>" |
| 75 | in <inttypes.h> would reinclude us, skipping our contents because |
| 76 | _GL_STDINT_H is defined. |
| 77 | The include_next requires a split double-inclusion guard. */ |
| 78 | # include_next <stdint.h> |
| 79 | #endif |
| 80 | |
| 81 | #if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H |
| 82 | #define _GL_STDINT_H |
| 83 | |
| 84 | /* <sys/types.h> defines some of the stdint.h types as well, on glibc, |
| 85 | IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). |
| 86 | AIX 5.2 <sys/types.h> isn't needed and causes troubles. |
| 87 | Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but |
| 88 | relies on the system <stdint.h> definitions, so include |
| 89 | <sys/types.h> after <stdint.h>. */ |
| 90 | #if 1 && ! defined _AIX |
| 91 | # include <sys/types.h> |
| 92 | #endif |
| 93 | |
| 94 | /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, |
| 95 | LONG_MIN, LONG_MAX, ULONG_MAX. */ |
| 96 | #include <limits.h> |
| 97 | |
| 98 | #if 1 |
| 99 | /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines |
| 100 | int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. |
| 101 | <inttypes.h> also defines intptr_t and uintptr_t. */ |
| 102 | # include <inttypes.h> |
| 103 | #elif 0 |
| 104 | /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and |
| 105 | the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ |
| 106 | # include <sys/inttypes.h> |
| 107 | #endif |
| 108 | |
| 109 | #if 0 && ! defined __BIT_TYPES_DEFINED__ |
| 110 | /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines |
| 111 | int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is |
| 112 | included by <sys/types.h>. */ |
| 113 | # include <sys/bitypes.h> |
| 114 | #endif |
| 115 | |
| 116 | #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H |
| 117 | |
| 118 | /* Minimum and maximum values for an integer type under the usual assumption. |
| 119 | Return an unspecified value if BITS == 0, adding a check to pacify |
| 120 | picky compilers. */ |
| 121 | |
| 122 | #define _STDINT_MIN(signed, bits, zero) \ |
| 123 | ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) |
| 124 | |
| 125 | #define _STDINT_MAX(signed, bits, zero) \ |
| 126 | ((signed) \ |
| 127 | ? ~ _STDINT_MIN (signed, bits, zero) \ |
| 128 | : /* The expression for the unsigned case. The subtraction of (signed) \ |
| 129 | is a nop in the unsigned case and avoids "signed integer overflow" \ |
| 130 | warnings in the signed case. */ \ |
| 131 | ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) |
| 132 | |
| 133 | #if !GNULIB_defined_stdint_types |
| 134 | |
| 135 | /* 7.18.1.1. Exact-width integer types */ |
| 136 | |
| 137 | /* Here we assume a standard architecture where the hardware integer |
| 138 | types have 8, 16, 32, optionally 64 bits. */ |
| 139 | |
| 140 | #undef int8_t |
| 141 | #undef uint8_t |
| 142 | typedef signed char gl_int8_t; |
| 143 | typedef unsigned char gl_uint8_t; |
| 144 | #define int8_t gl_int8_t |
| 145 | #define uint8_t gl_uint8_t |
| 146 | |
| 147 | #undef int16_t |
| 148 | #undef uint16_t |
| 149 | typedef short int gl_int16_t; |
| 150 | typedef unsigned short int gl_uint16_t; |
| 151 | #define int16_t gl_int16_t |
| 152 | #define uint16_t gl_uint16_t |
| 153 | |
| 154 | #undef int32_t |
| 155 | #undef uint32_t |
| 156 | typedef int gl_int32_t; |
| 157 | typedef unsigned int gl_uint32_t; |
| 158 | #define int32_t gl_int32_t |
| 159 | #define uint32_t gl_uint32_t |
| 160 | |
| 161 | /* If the system defines INT64_MAX, assume int64_t works. That way, |
| 162 | if the underlying platform defines int64_t to be a 64-bit long long |
| 163 | int, the code below won't mistakenly define it to be a 64-bit long |
| 164 | int, which would mess up C++ name mangling. We must use #ifdef |
| 165 | rather than #if, to avoid an error with HP-UX 10.20 cc. */ |
| 166 | |
| 167 | #ifdef INT64_MAX |
| 168 | # define GL_INT64_T |
| 169 | #else |
| 170 | /* Do not undefine int64_t if gnulib is not being used with 64-bit |
| 171 | types, since otherwise it breaks platforms like Tandem/NSK. */ |
| 172 | # if LONG_MAX >> 31 >> 31 == 1 |
| 173 | # undef int64_t |
| 174 | typedef long int gl_int64_t; |
| 175 | # define int64_t gl_int64_t |
| 176 | # define GL_INT64_T |
| 177 | # elif defined _MSC_VER |
| 178 | # undef int64_t |
| 179 | typedef __int64 gl_int64_t; |
| 180 | # define int64_t gl_int64_t |
| 181 | # define GL_INT64_T |
| 182 | # elif 1 |
| 183 | # undef int64_t |
| 184 | typedef long long int gl_int64_t; |
| 185 | # define int64_t gl_int64_t |
| 186 | # define GL_INT64_T |
| 187 | # endif |
| 188 | #endif |
| 189 | |
| 190 | #ifdef UINT64_MAX |
| 191 | # define GL_UINT64_T |
| 192 | #else |
| 193 | # if ULONG_MAX >> 31 >> 31 >> 1 == 1 |
| 194 | # undef uint64_t |
| 195 | typedef unsigned long int gl_uint64_t; |
| 196 | # define uint64_t gl_uint64_t |
| 197 | # define GL_UINT64_T |
| 198 | # elif defined _MSC_VER |
| 199 | # undef uint64_t |
| 200 | typedef unsigned __int64 gl_uint64_t; |
| 201 | # define uint64_t gl_uint64_t |
| 202 | # define GL_UINT64_T |
| 203 | # elif 1 |
| 204 | # undef uint64_t |
| 205 | typedef unsigned long long int gl_uint64_t; |
| 206 | # define uint64_t gl_uint64_t |
| 207 | # define GL_UINT64_T |
| 208 | # endif |
| 209 | #endif |
| 210 | |
| 211 | /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ |
| 212 | #define _UINT8_T |
| 213 | #define _UINT32_T |
| 214 | #define _UINT64_T |
| 215 | |
| 216 | |
| 217 | /* 7.18.1.2. Minimum-width integer types */ |
| 218 | |
| 219 | /* Here we assume a standard architecture where the hardware integer |
| 220 | types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types |
| 221 | are the same as the corresponding N_t types. */ |
| 222 | |
| 223 | #undef int_least8_t |
| 224 | #undef uint_least8_t |
| 225 | #undef int_least16_t |
| 226 | #undef uint_least16_t |
| 227 | #undef int_least32_t |
| 228 | #undef uint_least32_t |
| 229 | #undef int_least64_t |
| 230 | #undef uint_least64_t |
| 231 | #define int_least8_t int8_t |
| 232 | #define uint_least8_t uint8_t |
| 233 | #define int_least16_t int16_t |
| 234 | #define uint_least16_t uint16_t |
| 235 | #define int_least32_t int32_t |
| 236 | #define uint_least32_t uint32_t |
| 237 | #ifdef GL_INT64_T |
| 238 | # define int_least64_t int64_t |
| 239 | #endif |
| 240 | #ifdef GL_UINT64_T |
| 241 | # define uint_least64_t uint64_t |
| 242 | #endif |
| 243 | |
| 244 | /* 7.18.1.3. Fastest minimum-width integer types */ |
| 245 | |
| 246 | /* Note: Other <stdint.h> substitutes may define these types differently. |
| 247 | It is not recommended to use these types in public header files. */ |
| 248 | |
| 249 | /* Here we assume a standard architecture where the hardware integer |
| 250 | types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types |
| 251 | are taken from the same list of types. The following code normally |
| 252 | uses types consistent with glibc, as that lessens the chance of |
| 253 | incompatibility with older GNU hosts. */ |
| 254 | |
| 255 | #undef int_fast8_t |
| 256 | #undef uint_fast8_t |
| 257 | #undef int_fast16_t |
| 258 | #undef uint_fast16_t |
| 259 | #undef int_fast32_t |
| 260 | #undef uint_fast32_t |
| 261 | #undef int_fast64_t |
| 262 | #undef uint_fast64_t |
| 263 | typedef signed char gl_int_fast8_t; |
| 264 | typedef unsigned char gl_uint_fast8_t; |
| 265 | |
| 266 | #ifdef __sun |
| 267 | /* Define types compatible with SunOS 5.10, so that code compiled under |
| 268 | earlier SunOS versions works with code compiled under SunOS 5.10. */ |
| 269 | typedef int gl_int_fast32_t; |
| 270 | typedef unsigned int gl_uint_fast32_t; |
| 271 | #else |
| 272 | typedef long int gl_int_fast32_t; |
| 273 | typedef unsigned long int gl_uint_fast32_t; |
| 274 | #endif |
| 275 | typedef gl_int_fast32_t gl_int_fast16_t; |
| 276 | typedef gl_uint_fast32_t gl_uint_fast16_t; |
| 277 | |
| 278 | #define int_fast8_t gl_int_fast8_t |
| 279 | #define uint_fast8_t gl_uint_fast8_t |
| 280 | #define int_fast16_t gl_int_fast16_t |
| 281 | #define uint_fast16_t gl_uint_fast16_t |
| 282 | #define int_fast32_t gl_int_fast32_t |
| 283 | #define uint_fast32_t gl_uint_fast32_t |
| 284 | #ifdef GL_INT64_T |
| 285 | # define int_fast64_t int64_t |
| 286 | #endif |
| 287 | #ifdef GL_UINT64_T |
| 288 | # define uint_fast64_t uint64_t |
| 289 | #endif |
| 290 | |
| 291 | /* 7.18.1.4. Integer types capable of holding object pointers */ |
| 292 | |
| 293 | #undef intptr_t |
| 294 | #undef uintptr_t |
| 295 | typedef long int gl_intptr_t; |
| 296 | typedef unsigned long int gl_uintptr_t; |
| 297 | #define intptr_t gl_intptr_t |
| 298 | #define uintptr_t gl_uintptr_t |
| 299 | |
| 300 | /* 7.18.1.5. Greatest-width integer types */ |
| 301 | |
| 302 | /* Note: These types are compiler dependent. It may be unwise to use them in |
| 303 | public header files. */ |
| 304 | |
| 305 | /* If the system defines INTMAX_MAX, assume that intmax_t works, and |
| 306 | similarly for UINTMAX_MAX and uintmax_t. This avoids problems with |
| 307 | assuming one type where another is used by the system. */ |
| 308 | |
| 309 | #ifndef INTMAX_MAX |
| 310 | # undef INTMAX_C |
| 311 | # undef intmax_t |
| 312 | # if 1 && LONG_MAX >> 30 == 1 |
| 313 | typedef long long int gl_intmax_t; |
| 314 | # define intmax_t gl_intmax_t |
| 315 | # elif defined GL_INT64_T |
| 316 | # define intmax_t int64_t |
| 317 | # else |
| 318 | typedef long int gl_intmax_t; |
| 319 | # define intmax_t gl_intmax_t |
| 320 | # endif |
| 321 | #endif |
| 322 | |
| 323 | #ifndef UINTMAX_MAX |
| 324 | # undef UINTMAX_C |
| 325 | # undef uintmax_t |
| 326 | # if 1 && ULONG_MAX >> 31 == 1 |
| 327 | typedef unsigned long long int gl_uintmax_t; |
| 328 | # define uintmax_t gl_uintmax_t |
| 329 | # elif defined GL_UINT64_T |
| 330 | # define uintmax_t uint64_t |
| 331 | # else |
| 332 | typedef unsigned long int gl_uintmax_t; |
| 333 | # define uintmax_t gl_uintmax_t |
| 334 | # endif |
| 335 | #endif |
| 336 | |
| 337 | /* Verify that intmax_t and uintmax_t have the same size. Too much code |
| 338 | breaks if this is not the case. If this check fails, the reason is likely |
| 339 | to be found in the autoconf macros. */ |
| 340 | typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) |
| 341 | ? 1 : -1]; |
| 342 | |
| 343 | #define GNULIB_defined_stdint_types 1 |
| 344 | #endif /* !GNULIB_defined_stdint_types */ |
| 345 | |
| 346 | /* 7.18.2. Limits of specified-width integer types */ |
| 347 | |
| 348 | /* 7.18.2.1. Limits of exact-width integer types */ |
| 349 | |
| 350 | /* Here we assume a standard architecture where the hardware integer |
| 351 | types have 8, 16, 32, optionally 64 bits. */ |
| 352 | |
| 353 | #undef INT8_MIN |
| 354 | #undef INT8_MAX |
| 355 | #undef UINT8_MAX |
| 356 | #define INT8_MIN (~ INT8_MAX) |
| 357 | #define INT8_MAX 127 |
| 358 | #define UINT8_MAX 255 |
| 359 | |
| 360 | #undef INT16_MIN |
| 361 | #undef INT16_MAX |
| 362 | #undef UINT16_MAX |
| 363 | #define INT16_MIN (~ INT16_MAX) |
| 364 | #define INT16_MAX 32767 |
| 365 | #define UINT16_MAX 65535 |
| 366 | |
| 367 | #undef INT32_MIN |
| 368 | #undef INT32_MAX |
| 369 | #undef UINT32_MAX |
| 370 | #define INT32_MIN (~ INT32_MAX) |
| 371 | #define INT32_MAX 2147483647 |
| 372 | #define UINT32_MAX 4294967295U |
| 373 | |
| 374 | #if defined GL_INT64_T && ! defined INT64_MAX |
| 375 | /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 |
| 376 | evaluates the latter incorrectly in preprocessor expressions. */ |
| 377 | # define INT64_MIN (- INTMAX_C (1) << 63) |
| 378 | # define INT64_MAX INTMAX_C (9223372036854775807) |
| 379 | #endif |
| 380 | |
| 381 | #if defined GL_UINT64_T && ! defined UINT64_MAX |
| 382 | # define UINT64_MAX UINTMAX_C (18446744073709551615) |
| 383 | #endif |
| 384 | |
| 385 | /* 7.18.2.2. Limits of minimum-width integer types */ |
| 386 | |
| 387 | /* Here we assume a standard architecture where the hardware integer |
| 388 | types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types |
| 389 | are the same as the corresponding N_t types. */ |
| 390 | |
| 391 | #undef INT_LEAST8_MIN |
| 392 | #undef INT_LEAST8_MAX |
| 393 | #undef UINT_LEAST8_MAX |
| 394 | #define INT_LEAST8_MIN INT8_MIN |
| 395 | #define INT_LEAST8_MAX INT8_MAX |
| 396 | #define UINT_LEAST8_MAX UINT8_MAX |
| 397 | |
| 398 | #undef INT_LEAST16_MIN |
| 399 | #undef INT_LEAST16_MAX |
| 400 | #undef UINT_LEAST16_MAX |
| 401 | #define INT_LEAST16_MIN INT16_MIN |
| 402 | #define INT_LEAST16_MAX INT16_MAX |
| 403 | #define UINT_LEAST16_MAX UINT16_MAX |
| 404 | |
| 405 | #undef INT_LEAST32_MIN |
| 406 | #undef INT_LEAST32_MAX |
| 407 | #undef UINT_LEAST32_MAX |
| 408 | #define INT_LEAST32_MIN INT32_MIN |
| 409 | #define INT_LEAST32_MAX INT32_MAX |
| 410 | #define UINT_LEAST32_MAX UINT32_MAX |
| 411 | |
| 412 | #undef INT_LEAST64_MIN |
| 413 | #undef INT_LEAST64_MAX |
| 414 | #ifdef GL_INT64_T |
| 415 | # define INT_LEAST64_MIN INT64_MIN |
| 416 | # define INT_LEAST64_MAX INT64_MAX |
| 417 | #endif |
| 418 | |
| 419 | #undef UINT_LEAST64_MAX |
| 420 | #ifdef GL_UINT64_T |
| 421 | # define UINT_LEAST64_MAX UINT64_MAX |
| 422 | #endif |
| 423 | |
| 424 | /* 7.18.2.3. Limits of fastest minimum-width integer types */ |
| 425 | |
| 426 | /* Here we assume a standard architecture where the hardware integer |
| 427 | types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types |
| 428 | are taken from the same list of types. */ |
| 429 | |
| 430 | #undef INT_FAST8_MIN |
| 431 | #undef INT_FAST8_MAX |
| 432 | #undef UINT_FAST8_MAX |
| 433 | #define INT_FAST8_MIN SCHAR_MIN |
| 434 | #define INT_FAST8_MAX SCHAR_MAX |
| 435 | #define UINT_FAST8_MAX UCHAR_MAX |
| 436 | |
| 437 | #undef INT_FAST16_MIN |
| 438 | #undef INT_FAST16_MAX |
| 439 | #undef UINT_FAST16_MAX |
| 440 | #define INT_FAST16_MIN INT_FAST32_MIN |
| 441 | #define INT_FAST16_MAX INT_FAST32_MAX |
| 442 | #define UINT_FAST16_MAX UINT_FAST32_MAX |
| 443 | |
| 444 | #undef INT_FAST32_MIN |
| 445 | #undef INT_FAST32_MAX |
| 446 | #undef UINT_FAST32_MAX |
| 447 | #ifdef __sun |
| 448 | # define INT_FAST32_MIN INT_MIN |
| 449 | # define INT_FAST32_MAX INT_MAX |
| 450 | # define UINT_FAST32_MAX UINT_MAX |
| 451 | #else |
| 452 | # define INT_FAST32_MIN LONG_MIN |
| 453 | # define INT_FAST32_MAX LONG_MAX |
| 454 | # define UINT_FAST32_MAX ULONG_MAX |
| 455 | #endif |
| 456 | |
| 457 | #undef INT_FAST64_MIN |
| 458 | #undef INT_FAST64_MAX |
| 459 | #ifdef GL_INT64_T |
| 460 | # define INT_FAST64_MIN INT64_MIN |
| 461 | # define INT_FAST64_MAX INT64_MAX |
| 462 | #endif |
| 463 | |
| 464 | #undef UINT_FAST64_MAX |
| 465 | #ifdef GL_UINT64_T |
| 466 | # define UINT_FAST64_MAX UINT64_MAX |
| 467 | #endif |
| 468 | |
| 469 | /* 7.18.2.4. Limits of integer types capable of holding object pointers */ |
| 470 | |
| 471 | #undef INTPTR_MIN |
| 472 | #undef INTPTR_MAX |
| 473 | #undef UINTPTR_MAX |
| 474 | #define INTPTR_MIN LONG_MIN |
| 475 | #define INTPTR_MAX LONG_MAX |
| 476 | #define UINTPTR_MAX ULONG_MAX |
| 477 | |
| 478 | /* 7.18.2.5. Limits of greatest-width integer types */ |
| 479 | |
| 480 | #ifndef INTMAX_MAX |
| 481 | # undef INTMAX_MIN |
| 482 | # ifdef INT64_MAX |
| 483 | # define INTMAX_MIN INT64_MIN |
| 484 | # define INTMAX_MAX INT64_MAX |
| 485 | # else |
| 486 | # define INTMAX_MIN INT32_MIN |
| 487 | # define INTMAX_MAX INT32_MAX |
| 488 | # endif |
| 489 | #endif |
| 490 | |
| 491 | #ifndef UINTMAX_MAX |
| 492 | # ifdef UINT64_MAX |
| 493 | # define UINTMAX_MAX UINT64_MAX |
| 494 | # else |
| 495 | # define UINTMAX_MAX UINT32_MAX |
| 496 | # endif |
| 497 | #endif |
| 498 | |
| 499 | /* 7.18.3. Limits of other integer types */ |
| 500 | |
| 501 | /* ptrdiff_t limits */ |
| 502 | #undef PTRDIFF_MIN |
| 503 | #undef PTRDIFF_MAX |
| 504 | #if 0 |
| 505 | # ifdef _LP64 |
| 506 | # define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) |
| 507 | # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) |
| 508 | # else |
| 509 | # define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) |
| 510 | # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) |
| 511 | # endif |
| 512 | #else |
| 513 | # define PTRDIFF_MIN \ |
| 514 | _STDINT_MIN (1, 64, 0l) |
| 515 | # define PTRDIFF_MAX \ |
| 516 | _STDINT_MAX (1, 64, 0l) |
| 517 | #endif |
| 518 | |
| 519 | /* sig_atomic_t limits */ |
| 520 | #undef SIG_ATOMIC_MIN |
| 521 | #undef SIG_ATOMIC_MAX |
| 522 | #define SIG_ATOMIC_MIN \ |
| 523 | _STDINT_MIN (1, 32, \ |
| 524 | 0) |
| 525 | #define SIG_ATOMIC_MAX \ |
| 526 | _STDINT_MAX (1, 32, \ |
| 527 | 0) |
| 528 | |
| 529 | |
| 530 | /* size_t limit */ |
| 531 | #undef SIZE_MAX |
| 532 | #if 0 |
| 533 | # ifdef _LP64 |
| 534 | # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) |
| 535 | # else |
| 536 | # define SIZE_MAX _STDINT_MAX (0, 32, 0ul) |
| 537 | # endif |
| 538 | #else |
| 539 | # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) |
| 540 | #endif |
| 541 | |
| 542 | /* wchar_t limits */ |
| 543 | /* Get WCHAR_MIN, WCHAR_MAX. |
| 544 | This include is not on the top, above, because on OSF/1 4.0 we have a |
| 545 | sequence of nested includes |
| 546 | <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes |
| 547 | <stdint.h> and assumes its types are already defined. */ |
| 548 | #if 1 && ! (defined WCHAR_MIN && defined WCHAR_MAX) |
| 549 | /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be |
| 550 | included before <wchar.h>. */ |
| 551 | # include <stddef.h> |
| 552 | # include <stdio.h> |
| 553 | # include <time.h> |
| 554 | # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H |
| 555 | # include <wchar.h> |
| 556 | # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H |
| 557 | #endif |
| 558 | #undef WCHAR_MIN |
| 559 | #undef WCHAR_MAX |
| 560 | #define WCHAR_MIN \ |
| 561 | _STDINT_MIN (1, 32, 0) |
| 562 | #define WCHAR_MAX \ |
| 563 | _STDINT_MAX (1, 32, 0) |
| 564 | |
| 565 | /* wint_t limits */ |
| 566 | #undef WINT_MIN |
| 567 | #undef WINT_MAX |
| 568 | #define WINT_MIN \ |
| 569 | _STDINT_MIN (1, 32, 0) |
| 570 | #define WINT_MAX \ |
| 571 | _STDINT_MAX (1, 32, 0) |
| 572 | |
| 573 | /* 7.18.4. Macros for integer constants */ |
| 574 | |
| 575 | /* 7.18.4.1. Macros for minimum-width integer constants */ |
| 576 | /* According to ISO C 99 Technical Corrigendum 1 */ |
| 577 | |
| 578 | /* Here we assume a standard architecture where the hardware integer |
| 579 | types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ |
| 580 | |
| 581 | #undef INT8_C |
| 582 | #undef UINT8_C |
| 583 | #define INT8_C(x) x |
| 584 | #define UINT8_C(x) x |
| 585 | |
| 586 | #undef INT16_C |
| 587 | #undef UINT16_C |
| 588 | #define INT16_C(x) x |
| 589 | #define UINT16_C(x) x |
| 590 | |
| 591 | #undef INT32_C |
| 592 | #undef UINT32_C |
| 593 | #define INT32_C(x) x |
| 594 | #define UINT32_C(x) x ## U |
| 595 | |
| 596 | #undef INT64_C |
| 597 | #undef UINT64_C |
| 598 | #if LONG_MAX >> 31 >> 31 == 1 |
| 599 | # define INT64_C(x) x##L |
| 600 | #elif defined _MSC_VER |
| 601 | # define INT64_C(x) x##i64 |
| 602 | #elif 1 |
| 603 | # define INT64_C(x) x##LL |
| 604 | #endif |
| 605 | #if ULONG_MAX >> 31 >> 31 >> 1 == 1 |
| 606 | # define UINT64_C(x) x##UL |
| 607 | #elif defined _MSC_VER |
| 608 | # define UINT64_C(x) x##ui64 |
| 609 | #elif 1 |
| 610 | # define UINT64_C(x) x##ULL |
| 611 | #endif |
| 612 | |
| 613 | /* 7.18.4.2. Macros for greatest-width integer constants */ |
| 614 | |
| 615 | #ifndef INTMAX_C |
| 616 | # if 1 && LONG_MAX >> 30 == 1 |
| 617 | # define INTMAX_C(x) x##LL |
| 618 | # elif defined GL_INT64_T |
| 619 | # define INTMAX_C(x) INT64_C(x) |
| 620 | # else |
| 621 | # define INTMAX_C(x) x##L |
| 622 | # endif |
| 623 | #endif |
| 624 | |
| 625 | #ifndef UINTMAX_C |
| 626 | # if 1 && ULONG_MAX >> 31 == 1 |
| 627 | # define UINTMAX_C(x) x##ULL |
| 628 | # elif defined GL_UINT64_T |
| 629 | # define UINTMAX_C(x) UINT64_C(x) |
| 630 | # else |
| 631 | # define UINTMAX_C(x) x##UL |
| 632 | # endif |
| 633 | #endif |
| 634 | |
| 635 | #endif /* _GL_STDINT_H */ |
| 636 | #endif /* !(defined __ANDROID__ && ...) */ |
| 637 | #endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ |