cstdint 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // <cstdint> -*- C++ -*-
  2. // Copyright (C) 2007-2023 Free Software Foundation, Inc.
  3. //
  4. // This file is part of the GNU ISO C++ Library. This library is free
  5. // software; you can redistribute it and/or modify it under the
  6. // terms of the GNU General Public License as published by the
  7. // Free Software Foundation; either version 3, or (at your option)
  8. // any later version.
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // Under Section 7 of GPL version 3, you are granted additional
  14. // permissions described in the GCC Runtime Library Exception, version
  15. // 3.1, as published by the Free Software Foundation.
  16. // You should have received a copy of the GNU General Public License and
  17. // a copy of the GCC Runtime Library Exception along with this program;
  18. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. // <http://www.gnu.org/licenses/>.
  20. /** @file include/cstdint
  21. * This is a Standard C++ Library header.
  22. */
  23. #ifndef _GLIBCXX_CSTDINT
  24. #define _GLIBCXX_CSTDINT 1
  25. #pragma GCC system_header
  26. #if __cplusplus < 201103L
  27. # include <bits/c++0x_warning.h>
  28. #else
  29. #include <bits/c++config.h>
  30. #if ! _GLIBCXX_HOSTED && __has_include(<stdint-gcc.h>)
  31. // For --disable-hosted-libstdcxx we want GCC's own stdint-gcc.h header
  32. // even when -ffreestanding isn't used.
  33. # include <stdint-gcc.h>
  34. #elif __has_include(<stdint.h>)
  35. # include <stdint.h>
  36. #endif
  37. namespace std
  38. {
  39. #ifdef _GLIBCXX_USE_C99_STDINT_TR1
  40. using ::int8_t;
  41. using ::int16_t;
  42. using ::int32_t;
  43. using ::int64_t;
  44. using ::int_fast8_t;
  45. using ::int_fast16_t;
  46. using ::int_fast32_t;
  47. using ::int_fast64_t;
  48. using ::int_least8_t;
  49. using ::int_least16_t;
  50. using ::int_least32_t;
  51. using ::int_least64_t;
  52. using ::intmax_t;
  53. using ::intptr_t;
  54. using ::uint8_t;
  55. using ::uint16_t;
  56. using ::uint32_t;
  57. using ::uint64_t;
  58. using ::uint_fast8_t;
  59. using ::uint_fast16_t;
  60. using ::uint_fast32_t;
  61. using ::uint_fast64_t;
  62. using ::uint_least8_t;
  63. using ::uint_least16_t;
  64. using ::uint_least32_t;
  65. using ::uint_least64_t;
  66. using ::uintmax_t;
  67. using ::uintptr_t;
  68. #else // !_GLIBCXX_USE_C99_STDINT_TR1
  69. using intmax_t = __INTMAX_TYPE__;
  70. using uintmax_t = __UINTMAX_TYPE__;
  71. #ifdef __INT8_TYPE__
  72. using int8_t = __INT8_TYPE__;
  73. #endif
  74. #ifdef __INT16_TYPE__
  75. using int16_t = __INT16_TYPE__;
  76. #endif
  77. #ifdef __INT32_TYPE__
  78. using int32_t = __INT32_TYPE__;
  79. #endif
  80. #ifdef __INT64_TYPE__
  81. using int64_t = __INT64_TYPE__;
  82. #endif
  83. using int_least8_t = __INT_LEAST8_TYPE__;
  84. using int_least16_t = __INT_LEAST16_TYPE__;
  85. using int_least32_t = __INT_LEAST32_TYPE__;
  86. using int_least64_t = __INT_LEAST64_TYPE__;
  87. using int_fast8_t = __INT_FAST8_TYPE__;
  88. using int_fast16_t = __INT_FAST16_TYPE__;
  89. using int_fast32_t = __INT_FAST32_TYPE__;
  90. using int_fast64_t = __INT_FAST64_TYPE__;
  91. #ifdef __INTPTR_TYPE__
  92. using intptr_t = __INTPTR_TYPE__;
  93. #endif
  94. #ifdef __UINT8_TYPE__
  95. using uint8_t = __UINT8_TYPE__;
  96. #endif
  97. #ifdef __UINT16_TYPE__
  98. using uint16_t = __UINT16_TYPE__;
  99. #endif
  100. #ifdef __UINT32_TYPE__
  101. using uint32_t = __UINT32_TYPE__;
  102. #endif
  103. #ifdef __UINT64_TYPE__
  104. using uint64_t = __UINT64_TYPE__;
  105. #endif
  106. using uint_least8_t = __UINT_LEAST8_TYPE__;
  107. using uint_least16_t = __UINT_LEAST16_TYPE__;
  108. using uint_least32_t = __UINT_LEAST32_TYPE__;
  109. using uint_least64_t = __UINT_LEAST64_TYPE__;
  110. using uint_fast8_t = __UINT_FAST8_TYPE__;
  111. using uint_fast16_t = __UINT_FAST16_TYPE__;
  112. using uint_fast32_t = __UINT_FAST32_TYPE__;
  113. using uint_fast64_t = __UINT_FAST64_TYPE__;
  114. #ifdef __UINTPTR_TYPE__
  115. using uintptr_t = __UINTPTR_TYPE__;
  116. #endif
  117. #endif // _GLIBCXX_USE_C99_STDINT_TR1
  118. } // namespace std
  119. #endif // C++11
  120. #endif // _GLIBCXX_CSTDINT