stdint.h (22683B)
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* Copyright (C) 2001-2002, 2004-2024 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 file is free software: you can redistribute it and/or modify 7 it under the terms of the GNU Lesser General Public License as 8 published by the Free Software Foundation; either version 2.1 of the 9 License, or (at your option) any later version. 10 11 This file 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 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 18 19 /* 20 * ISO C 99 <stdint.h> for platforms that lack it. 21 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/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__ && defined _GL_INCLUDING_SYS_TYPES_H 43 # include_next <stdint.h> 44 #else 45 46 /* Get those types that are already defined in other system include 47 files, so that we can "#define int8_t signed char" below without 48 worrying about a later system include file containing a "typedef 49 signed char int8_t;" that will get messed up by our macro. Our 50 macros should all be consistent with the system versions, except 51 for the "fast" types and macros, which we recommend against using 52 in public interfaces due to compiler differences. */ 53 54 #if 1 55 # if defined __sgi && ! defined __c99 56 /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users 57 with "This header file is to be used only for c99 mode compilations" 58 diagnostics. */ 59 # define __STDINT_H__ 60 # endif 61 62 /* Some pre-C++11 <stdint.h> implementations need this. */ 63 # ifdef __cplusplus 64 # ifndef __STDC_CONSTANT_MACROS 65 # define __STDC_CONSTANT_MACROS 1 66 # endif 67 # ifndef __STDC_LIMIT_MACROS 68 # define __STDC_LIMIT_MACROS 1 69 # endif 70 # endif 71 72 /* Other systems may have an incomplete or buggy <stdint.h>. 73 Include it before <inttypes.h>, since any "#include <stdint.h>" 74 in <inttypes.h> would reinclude us, skipping our contents because 75 _GL_STDINT_H is defined. 76 The include_next requires a split double-inclusion guard. */ 77 # include_next <stdint.h> 78 #endif 79 80 #if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H 81 #define _GL_STDINT_H 82 83 /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, 84 LONG_MIN, LONG_MAX, ULONG_MAX, CHAR_BIT, _GL_INTEGER_WIDTH. */ 85 #include <limits.h> 86 87 /* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides 88 wint_t. */ 89 #if 0 90 # undef WINT_MIN 91 # undef WINT_MAX 92 # define WINT_MIN 0x0U 93 # define WINT_MAX 0xffffffffU 94 #endif 95 96 #if ! 0 97 98 /* <sys/types.h> defines some of the stdint.h types as well, on glibc, 99 IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). 100 AIX 5.2 <sys/types.h> isn't needed and causes troubles. 101 Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but 102 relies on the system <stdint.h> definitions, so include 103 <sys/types.h> after <stdint.h>. */ 104 # if 1 && ! defined _AIX 105 # include <sys/types.h> 106 # endif 107 108 # if 1 109 /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines 110 int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. 111 <inttypes.h> also defines intptr_t and uintptr_t. */ 112 # include <inttypes.h> 113 # elif 0 114 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and 115 the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ 116 # include <sys/inttypes.h> 117 # endif 118 119 # if 0 && ! defined __BIT_TYPES_DEFINED__ 120 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines 121 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is 122 included by <sys/types.h>. */ 123 # include <sys/bitypes.h> 124 # endif 125 126 # undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H 127 128 /* Minimum and maximum values for an integer type under the usual assumption. 129 Return an unspecified value if BITS == 0, adding a check to pacify 130 picky compilers. */ 131 132 /* These are separate macros, because if you try to merge these macros into 133 a single one, HP-UX cc rejects the resulting expression in constant 134 expressions. */ 135 # define _STDINT_UNSIGNED_MIN(bits, zero) \ 136 (zero) 137 # define _STDINT_SIGNED_MIN(bits, zero) \ 138 (~ _STDINT_MAX (1, bits, zero)) 139 140 # define _STDINT_MAX(signed, bits, zero) \ 141 (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) 142 143 #if !GNULIB_defined_stdint_types 144 145 /* 7.18.1.1. Exact-width integer types */ 146 147 /* Here we assume a standard architecture where the hardware integer 148 types have 8, 16, 32, optionally 64 bits. */ 149 150 # undef int8_t 151 # undef uint8_t 152 typedef signed char gl_int8_t; 153 typedef unsigned char gl_uint8_t; 154 # define int8_t gl_int8_t 155 # define uint8_t gl_uint8_t 156 157 # undef int16_t 158 # undef uint16_t 159 typedef short int gl_int16_t; 160 typedef unsigned short int gl_uint16_t; 161 # define int16_t gl_int16_t 162 # define uint16_t gl_uint16_t 163 164 # undef int32_t 165 # undef uint32_t 166 typedef int gl_int32_t; 167 typedef unsigned int gl_uint32_t; 168 # define int32_t gl_int32_t 169 # define uint32_t gl_uint32_t 170 171 /* If the system defines INT64_MAX, assume int64_t works. That way, 172 if the underlying platform defines int64_t to be a 64-bit long long 173 int, the code below won't mistakenly define it to be a 64-bit long 174 int, which would mess up C++ name mangling. We must use #ifdef 175 rather than #if, to avoid an error with HP-UX 10.20 cc. */ 176 177 # ifdef INT64_MAX 178 # define GL_INT64_T 179 # else 180 /* Do not undefine int64_t if gnulib is not being used with 64-bit 181 types, since otherwise it breaks platforms like Tandem/NSK. */ 182 # if LONG_MAX >> 31 >> 31 == 1 183 # undef int64_t 184 typedef long int gl_int64_t; 185 # define int64_t gl_int64_t 186 # define GL_INT64_T 187 # elif defined _MSC_VER 188 # undef int64_t 189 typedef __int64 gl_int64_t; 190 # define int64_t gl_int64_t 191 # define GL_INT64_T 192 # else 193 /* Verify that 'long long' has exactly 64 bits. */ 194 typedef _gl_verify_int64_bits[ 195 _STDINT_MAX (1, sizeof (long long) * CHAR_BIT, 0ll) >> 31 >> 31 == 1 196 ? 1 : -1]; 197 # undef int64_t 198 typedef long long int gl_int64_t; 199 # define int64_t gl_int64_t 200 # define GL_INT64_T 201 # endif 202 # endif 203 204 # ifdef UINT64_MAX 205 # define GL_UINT64_T 206 # else 207 # if ULONG_MAX >> 31 >> 31 >> 1 == 1 208 # undef uint64_t 209 typedef unsigned long int gl_uint64_t; 210 # define uint64_t gl_uint64_t 211 # define GL_UINT64_T 212 # elif defined _MSC_VER 213 # undef uint64_t 214 typedef unsigned __int64 gl_uint64_t; 215 # define uint64_t gl_uint64_t 216 # define GL_UINT64_T 217 # else 218 /* Verify that 'unsigned long long' has exactly 64 bits. */ 219 typedef _gl_verify_uint64_bits[ 220 _STDINT_MAX (0, sizeof (unsigned long long) * CHAR_BIT, 0ull) 221 >> 31 >> 31 >> 1 == 1 222 ? 1 : -1]; 223 # undef uint64_t 224 typedef unsigned long long int gl_uint64_t; 225 # define uint64_t gl_uint64_t 226 # define GL_UINT64_T 227 # endif 228 # endif 229 230 /* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */ 231 # define _UINT8_T 232 # define _UINT32_T 233 # define _UINT64_T 234 235 236 /* 7.18.1.2. Minimum-width integer types */ 237 238 /* Here we assume a standard architecture where the hardware integer 239 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types 240 are the same as the corresponding N_t types. */ 241 242 # undef int_least8_t 243 # undef uint_least8_t 244 # undef int_least16_t 245 # undef uint_least16_t 246 # undef int_least32_t 247 # undef uint_least32_t 248 # undef int_least64_t 249 # undef uint_least64_t 250 # define int_least8_t int8_t 251 # define uint_least8_t uint8_t 252 # define int_least16_t int16_t 253 # define uint_least16_t uint16_t 254 # define int_least32_t int32_t 255 # define uint_least32_t uint32_t 256 # ifdef GL_INT64_T 257 # define int_least64_t int64_t 258 # endif 259 # ifdef GL_UINT64_T 260 # define uint_least64_t uint64_t 261 # endif 262 263 /* 7.18.1.3. Fastest minimum-width integer types */ 264 265 /* Note: Other <stdint.h> substitutes may define these types differently. 266 It is not recommended to use these types in public header files. */ 267 268 /* Here we assume a standard architecture where the hardware integer 269 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types 270 are taken from the same list of types. The following code normally 271 uses types consistent with glibc, as that lessens the chance of 272 incompatibility with older GNU hosts. */ 273 274 # undef int_fast8_t 275 # undef uint_fast8_t 276 # undef int_fast16_t 277 # undef uint_fast16_t 278 # undef int_fast32_t 279 # undef uint_fast32_t 280 # undef int_fast64_t 281 # undef uint_fast64_t 282 typedef signed char gl_int_fast8_t; 283 typedef unsigned char gl_uint_fast8_t; 284 285 # ifdef __sun 286 /* Define types compatible with SunOS 5.10, so that code compiled under 287 earlier SunOS versions works with code compiled under SunOS 5.10. */ 288 typedef int gl_int_fast32_t; 289 typedef unsigned int gl_uint_fast32_t; 290 # else 291 typedef long int gl_int_fast32_t; 292 typedef unsigned long int gl_uint_fast32_t; 293 # endif 294 typedef gl_int_fast32_t gl_int_fast16_t; 295 typedef gl_uint_fast32_t gl_uint_fast16_t; 296 297 # define int_fast8_t gl_int_fast8_t 298 # define uint_fast8_t gl_uint_fast8_t 299 # define int_fast16_t gl_int_fast16_t 300 # define uint_fast16_t gl_uint_fast16_t 301 # define int_fast32_t gl_int_fast32_t 302 # define uint_fast32_t gl_uint_fast32_t 303 # ifdef GL_INT64_T 304 # define int_fast64_t int64_t 305 # endif 306 # ifdef GL_UINT64_T 307 # define uint_fast64_t uint64_t 308 # endif 309 310 /* 7.18.1.4. Integer types capable of holding object pointers */ 311 312 /* kLIBC's <stdint.h> defines _INTPTR_T_DECLARED and needs its own 313 definitions of intptr_t and uintptr_t (which use int and unsigned) 314 to avoid clashes with declarations of system functions like sbrk. 315 Similarly, MinGW WSL-5.4.1 <stdint.h> needs its own intptr_t and 316 uintptr_t to avoid conflicting declarations of system functions like 317 _findclose in <io.h>. */ 318 # if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ 319 || (defined __INTPTR_WIDTH__ \ 320 && __INTPTR_WIDTH__ != (defined _WIN64 ? LLONG_WIDTH : LONG_WIDTH)) \ 321 || defined __MINGW32__) 322 # undef intptr_t 323 # undef uintptr_t 324 # ifdef _WIN64 325 typedef long long int gl_intptr_t; 326 typedef unsigned long long int gl_uintptr_t; 327 # else 328 typedef long int gl_intptr_t; 329 typedef unsigned long int gl_uintptr_t; 330 # endif 331 # define intptr_t gl_intptr_t 332 # define uintptr_t gl_uintptr_t 333 # endif 334 335 /* 7.18.1.5. Greatest-width integer types */ 336 337 /* Note: These types are compiler dependent. It may be unwise to use them in 338 public header files. */ 339 340 /* If the system defines INTMAX_MAX, assume that intmax_t works, and 341 similarly for UINTMAX_MAX and uintmax_t. This avoids problems with 342 assuming one type where another is used by the system. */ 343 344 # ifndef INTMAX_MAX 345 # undef INTMAX_C 346 # undef intmax_t 347 # if LONG_MAX >> 30 == 1 348 typedef long long int gl_intmax_t; 349 # define intmax_t gl_intmax_t 350 # elif defined GL_INT64_T 351 # define intmax_t int64_t 352 # else 353 typedef long int gl_intmax_t; 354 # define intmax_t gl_intmax_t 355 # endif 356 # endif 357 358 # ifndef UINTMAX_MAX 359 # undef UINTMAX_C 360 # undef uintmax_t 361 # if ULONG_MAX >> 31 == 1 362 typedef unsigned long long int gl_uintmax_t; 363 # define uintmax_t gl_uintmax_t 364 # elif defined GL_UINT64_T 365 # define uintmax_t uint64_t 366 # else 367 typedef unsigned long int gl_uintmax_t; 368 # define uintmax_t gl_uintmax_t 369 # endif 370 # endif 371 372 /* Verify that intmax_t and uintmax_t have the same size. Too much code 373 breaks if this is not the case. If this check fails, the reason is likely 374 to be found in the autoconf macros. */ 375 typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) 376 ? 1 : -1]; 377 378 # define GNULIB_defined_stdint_types 1 379 # endif /* !GNULIB_defined_stdint_types */ 380 381 /* 7.18.2. Limits of specified-width integer types */ 382 383 /* 7.18.2.1. Limits of exact-width integer types */ 384 385 /* Here we assume a standard architecture where the hardware integer 386 types have 8, 16, 32, optionally 64 bits. */ 387 388 # undef INT8_MIN 389 # undef INT8_MAX 390 # undef UINT8_MAX 391 # define INT8_MIN (~ INT8_MAX) 392 # define INT8_MAX 127 393 # define UINT8_MAX 255 394 395 # undef INT16_MIN 396 # undef INT16_MAX 397 # undef UINT16_MAX 398 # define INT16_MIN (~ INT16_MAX) 399 # define INT16_MAX 32767 400 # define UINT16_MAX 65535 401 402 # undef INT32_MIN 403 # undef INT32_MAX 404 # undef UINT32_MAX 405 # define INT32_MIN (~ INT32_MAX) 406 # define INT32_MAX 2147483647 407 # define UINT32_MAX 4294967295U 408 409 # if defined GL_INT64_T && ! defined INT64_MAX 410 /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 411 evaluates the latter incorrectly in preprocessor expressions. */ 412 # define INT64_MIN (- INTMAX_C (1) << 63) 413 # define INT64_MAX INTMAX_C (9223372036854775807) 414 # endif 415 416 # if defined GL_UINT64_T && ! defined UINT64_MAX 417 # define UINT64_MAX UINTMAX_C (18446744073709551615) 418 # endif 419 420 /* 7.18.2.2. Limits of minimum-width integer types */ 421 422 /* Here we assume a standard architecture where the hardware integer 423 types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types 424 are the same as the corresponding N_t types. */ 425 426 # undef INT_LEAST8_MIN 427 # undef INT_LEAST8_MAX 428 # undef UINT_LEAST8_MAX 429 # define INT_LEAST8_MIN INT8_MIN 430 # define INT_LEAST8_MAX INT8_MAX 431 # define UINT_LEAST8_MAX UINT8_MAX 432 433 # undef INT_LEAST16_MIN 434 # undef INT_LEAST16_MAX 435 # undef UINT_LEAST16_MAX 436 # define INT_LEAST16_MIN INT16_MIN 437 # define INT_LEAST16_MAX INT16_MAX 438 # define UINT_LEAST16_MAX UINT16_MAX 439 440 # undef INT_LEAST32_MIN 441 # undef INT_LEAST32_MAX 442 # undef UINT_LEAST32_MAX 443 # define INT_LEAST32_MIN INT32_MIN 444 # define INT_LEAST32_MAX INT32_MAX 445 # define UINT_LEAST32_MAX UINT32_MAX 446 447 # undef INT_LEAST64_MIN 448 # undef INT_LEAST64_MAX 449 # ifdef GL_INT64_T 450 # define INT_LEAST64_MIN INT64_MIN 451 # define INT_LEAST64_MAX INT64_MAX 452 # endif 453 454 # undef UINT_LEAST64_MAX 455 # ifdef GL_UINT64_T 456 # define UINT_LEAST64_MAX UINT64_MAX 457 # endif 458 459 /* 7.18.2.3. Limits of fastest minimum-width integer types */ 460 461 /* Here we assume a standard architecture where the hardware integer 462 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types 463 are taken from the same list of types. */ 464 465 # undef INT_FAST8_MIN 466 # undef INT_FAST8_MAX 467 # undef UINT_FAST8_MAX 468 # define INT_FAST8_MIN SCHAR_MIN 469 # define INT_FAST8_MAX SCHAR_MAX 470 # define UINT_FAST8_MAX UCHAR_MAX 471 472 # undef INT_FAST16_MIN 473 # undef INT_FAST16_MAX 474 # undef UINT_FAST16_MAX 475 # define INT_FAST16_MIN INT_FAST32_MIN 476 # define INT_FAST16_MAX INT_FAST32_MAX 477 # define UINT_FAST16_MAX UINT_FAST32_MAX 478 479 # undef INT_FAST32_MIN 480 # undef INT_FAST32_MAX 481 # undef UINT_FAST32_MAX 482 # ifdef __sun 483 # define INT_FAST32_MIN INT_MIN 484 # define INT_FAST32_MAX INT_MAX 485 # define UINT_FAST32_MAX UINT_MAX 486 # else 487 # define INT_FAST32_MIN LONG_MIN 488 # define INT_FAST32_MAX LONG_MAX 489 # define UINT_FAST32_MAX ULONG_MAX 490 # endif 491 492 # undef INT_FAST64_MIN 493 # undef INT_FAST64_MAX 494 # ifdef GL_INT64_T 495 # define INT_FAST64_MIN INT64_MIN 496 # define INT_FAST64_MAX INT64_MAX 497 # endif 498 499 # undef UINT_FAST64_MAX 500 # ifdef GL_UINT64_T 501 # define UINT_FAST64_MAX UINT64_MAX 502 # endif 503 504 /* 7.18.2.4. Limits of integer types capable of holding object pointers */ 505 506 # undef INTPTR_MIN 507 # undef INTPTR_MAX 508 # undef UINTPTR_MAX 509 # ifdef _WIN64 510 # define INTPTR_MIN LLONG_MIN 511 # define INTPTR_MAX LLONG_MAX 512 # define UINTPTR_MAX ULLONG_MAX 513 # else 514 # define INTPTR_MIN LONG_MIN 515 # define INTPTR_MAX LONG_MAX 516 # define UINTPTR_MAX ULONG_MAX 517 # endif 518 519 /* 7.18.2.5. Limits of greatest-width integer types */ 520 521 # ifndef INTMAX_MAX 522 # undef INTMAX_MIN 523 # ifdef INT64_MAX 524 # define INTMAX_MIN INT64_MIN 525 # define INTMAX_MAX INT64_MAX 526 # else 527 # define INTMAX_MIN INT32_MIN 528 # define INTMAX_MAX INT32_MAX 529 # endif 530 # endif 531 532 # ifndef UINTMAX_MAX 533 # ifdef UINT64_MAX 534 # define UINTMAX_MAX UINT64_MAX 535 # else 536 # define UINTMAX_MAX UINT32_MAX 537 # endif 538 # endif 539 540 /* 7.18.3. Limits of other integer types */ 541 542 /* ptrdiff_t limits */ 543 # undef PTRDIFF_MIN 544 # undef PTRDIFF_MAX 545 # if 0 546 # ifdef _LP64 547 # define PTRDIFF_MIN _STDINT_SIGNED_MIN (64, 0l) 548 # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) 549 # else 550 # define PTRDIFF_MIN _STDINT_SIGNED_MIN (32, 0) 551 # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) 552 # endif 553 # else 554 # define PTRDIFF_MIN \ 555 _STDINT_SIGNED_MIN (64, 0l) 556 # define PTRDIFF_MAX \ 557 _STDINT_MAX (1, 64, 0l) 558 # endif 559 560 /* sig_atomic_t limits */ 561 # undef SIG_ATOMIC_MIN 562 # undef SIG_ATOMIC_MAX 563 # if 1 564 # define SIG_ATOMIC_MIN \ 565 _STDINT_SIGNED_MIN (32, 0) 566 # else 567 # define SIG_ATOMIC_MIN \ 568 _STDINT_UNSIGNED_MIN (32, 0) 569 # endif 570 # define SIG_ATOMIC_MAX \ 571 _STDINT_MAX (1, 32, \ 572 0) 573 574 575 /* size_t limit */ 576 # undef SIZE_MAX 577 # if 0 578 # ifdef _LP64 579 # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) 580 # else 581 # define SIZE_MAX _STDINT_MAX (0, 32, 0ul) 582 # endif 583 # else 584 # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) 585 # endif 586 587 /* wchar_t limits */ 588 /* Get WCHAR_MIN, WCHAR_MAX. 589 This include is not on the top, above, because on OSF/1 4.0 we have a 590 sequence of nested includes 591 <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes 592 <stdint.h> and assumes its types are already defined. */ 593 # if 1 && ! (defined WCHAR_MIN && defined WCHAR_MAX) 594 # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H 595 # include <wchar.h> 596 # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H 597 # endif 598 # undef WCHAR_MIN 599 # undef WCHAR_MAX 600 # if 0 601 # define WCHAR_MIN \ 602 _STDINT_SIGNED_MIN (32, 0u) 603 # else 604 # define WCHAR_MIN \ 605 _STDINT_UNSIGNED_MIN (32, 0u) 606 # endif 607 # define WCHAR_MAX \ 608 _STDINT_MAX (0, 32, 0u) 609 610 /* wint_t limits */ 611 /* If gnulib's <wchar.h> or <wctype.h> overrides wint_t, u is not 612 accurate, therefore use the definitions from above. */ 613 # if !0 614 # undef WINT_MIN 615 # undef WINT_MAX 616 # if 0 617 # define WINT_MIN \ 618 _STDINT_SIGNED_MIN (32, 0u) 619 # else 620 # define WINT_MIN \ 621 _STDINT_UNSIGNED_MIN (32, 0u) 622 # endif 623 # define WINT_MAX \ 624 _STDINT_MAX (0, 32, 0u) 625 # endif 626 627 /* 7.18.4. Macros for integer constants */ 628 629 /* 7.18.4.1. Macros for minimum-width integer constants */ 630 /* According to ISO C 99 Technical Corrigendum 1 */ 631 632 /* Here we assume a standard architecture where the hardware integer 633 types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ 634 635 # undef INT8_C 636 # undef UINT8_C 637 # define INT8_C(x) x 638 # define UINT8_C(x) x 639 640 # undef INT16_C 641 # undef UINT16_C 642 # define INT16_C(x) x 643 # define UINT16_C(x) x 644 645 # undef INT32_C 646 # undef UINT32_C 647 # define INT32_C(x) x 648 # define UINT32_C(x) x ## U 649 650 # undef INT64_C 651 # undef UINT64_C 652 # if LONG_MAX >> 31 >> 31 == 1 653 # define INT64_C(x) x##L 654 # elif defined _MSC_VER 655 # define INT64_C(x) x##i64 656 # else 657 # define INT64_C(x) x##LL 658 # endif 659 # if ULONG_MAX >> 31 >> 31 >> 1 == 1 660 # define UINT64_C(x) x##UL 661 # elif defined _MSC_VER 662 # define UINT64_C(x) x##ui64 663 # else 664 # define UINT64_C(x) x##ULL 665 # endif 666 667 /* 7.18.4.2. Macros for greatest-width integer constants */ 668 669 # ifndef INTMAX_C 670 # if LONG_MAX >> 30 == 1 671 # define INTMAX_C(x) x##LL 672 # elif defined GL_INT64_T 673 # define INTMAX_C(x) INT64_C(x) 674 # else 675 # define INTMAX_C(x) x##L 676 # endif 677 # endif 678 679 # ifndef UINTMAX_C 680 # if ULONG_MAX >> 31 == 1 681 # define UINTMAX_C(x) x##ULL 682 # elif defined GL_UINT64_T 683 # define UINTMAX_C(x) UINT64_C(x) 684 # else 685 # define UINTMAX_C(x) x##UL 686 # endif 687 # endif 688 689 #endif /* !0 */ 690 691 /* Macros specified by ISO/IEC TS 18661-1:2014. */ 692 693 #if (!defined UINTMAX_WIDTH \ 694 && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) 695 # ifdef INT8_MAX 696 # define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) 697 # endif 698 # ifdef UINT8_MAX 699 # define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) 700 # endif 701 # ifdef INT16_MAX 702 # define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) 703 # endif 704 # ifdef UINT16_MAX 705 # define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) 706 # endif 707 # ifdef INT32_MAX 708 # define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) 709 # endif 710 # ifdef UINT32_MAX 711 # define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) 712 # endif 713 # ifdef INT64_MAX 714 # define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) 715 # endif 716 # ifdef UINT64_MAX 717 # define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) 718 # endif 719 # define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) 720 # define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) 721 # define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) 722 # define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) 723 # define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) 724 # define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) 725 # define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) 726 # define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) 727 # define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) 728 # define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) 729 # define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) 730 # define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) 731 # define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) 732 # define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) 733 # define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) 734 # define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) 735 # define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) 736 # define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) 737 # define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) 738 # define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) 739 # define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) 740 # define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) 741 # define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) 742 # ifdef WINT_MAX 743 # define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) 744 # endif 745 # ifdef SIG_ATOMIC_MAX 746 # define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) 747 # endif 748 #endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ 749 750 #endif /* _GL_STDINT_H */ 751 #endif /* !(defined __ANDROID__ && ...) */ 752 #endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */