stdint-gcc.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /* Copyright (C) 2008-2015 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. /*
  19. * ISO C Standard: 7.18 Integer types <stdint.h>
  20. */
  21. #ifndef _GCC_STDINT_H
  22. #define _GCC_STDINT_H
  23. /* 7.8.1.1 Exact-width integer types */
  24. #ifdef __INT8_TYPE__
  25. typedef __INT8_TYPE__ int8_t;
  26. #endif
  27. #ifdef __INT16_TYPE__
  28. typedef __INT16_TYPE__ int16_t;
  29. #endif
  30. #ifdef __INT32_TYPE__
  31. typedef __INT32_TYPE__ int32_t;
  32. #endif
  33. #ifdef __INT64_TYPE__
  34. typedef __INT64_TYPE__ int64_t;
  35. #endif
  36. #ifdef __UINT8_TYPE__
  37. typedef __UINT8_TYPE__ uint8_t;
  38. #endif
  39. #ifdef __UINT16_TYPE__
  40. typedef __UINT16_TYPE__ uint16_t;
  41. #endif
  42. #ifdef __UINT32_TYPE__
  43. typedef __UINT32_TYPE__ uint32_t;
  44. #endif
  45. #ifdef __UINT64_TYPE__
  46. typedef __UINT64_TYPE__ uint64_t;
  47. #endif
  48. /* 7.8.1.2 Minimum-width integer types */
  49. typedef __INT_LEAST8_TYPE__ int_least8_t;
  50. typedef __INT_LEAST16_TYPE__ int_least16_t;
  51. typedef __INT_LEAST32_TYPE__ int_least32_t;
  52. typedef __INT_LEAST64_TYPE__ int_least64_t;
  53. typedef __UINT_LEAST8_TYPE__ uint_least8_t;
  54. typedef __UINT_LEAST16_TYPE__ uint_least16_t;
  55. typedef __UINT_LEAST32_TYPE__ uint_least32_t;
  56. typedef __UINT_LEAST64_TYPE__ uint_least64_t;
  57. /* 7.8.1.3 Fastest minimum-width integer types */
  58. typedef __INT_FAST8_TYPE__ int_fast8_t;
  59. typedef __INT_FAST16_TYPE__ int_fast16_t;
  60. typedef __INT_FAST32_TYPE__ int_fast32_t;
  61. typedef __INT_FAST64_TYPE__ int_fast64_t;
  62. typedef __UINT_FAST8_TYPE__ uint_fast8_t;
  63. typedef __UINT_FAST16_TYPE__ uint_fast16_t;
  64. typedef __UINT_FAST32_TYPE__ uint_fast32_t;
  65. typedef __UINT_FAST64_TYPE__ uint_fast64_t;
  66. /* 7.8.1.4 Integer types capable of holding object pointers */
  67. #ifdef __INTPTR_TYPE__
  68. typedef __INTPTR_TYPE__ intptr_t;
  69. #endif
  70. #ifdef __UINTPTR_TYPE__
  71. typedef __UINTPTR_TYPE__ uintptr_t;
  72. #endif
  73. /* 7.8.1.5 Greatest-width integer types */
  74. typedef __INTMAX_TYPE__ intmax_t;
  75. typedef __UINTMAX_TYPE__ uintmax_t;
  76. #if (!defined __cplusplus || __cplusplus >= 201103L \
  77. || defined __STDC_LIMIT_MACROS)
  78. /* 7.18.2 Limits of specified-width integer types */
  79. #ifdef __INT8_MAX__
  80. # undef INT8_MAX
  81. # define INT8_MAX __INT8_MAX__
  82. # undef INT8_MIN
  83. # define INT8_MIN (-INT8_MAX - 1)
  84. #endif
  85. #ifdef __UINT8_MAX__
  86. # undef UINT8_MAX
  87. # define UINT8_MAX __UINT8_MAX__
  88. #endif
  89. #ifdef __INT16_MAX__
  90. # undef INT16_MAX
  91. # define INT16_MAX __INT16_MAX__
  92. # undef INT16_MIN
  93. # define INT16_MIN (-INT16_MAX - 1)
  94. #endif
  95. #ifdef __UINT16_MAX__
  96. # undef UINT16_MAX
  97. # define UINT16_MAX __UINT16_MAX__
  98. #endif
  99. #ifdef __INT32_MAX__
  100. # undef INT32_MAX
  101. # define INT32_MAX __INT32_MAX__
  102. # undef INT32_MIN
  103. # define INT32_MIN (-INT32_MAX - 1)
  104. #endif
  105. #ifdef __UINT32_MAX__
  106. # undef UINT32_MAX
  107. # define UINT32_MAX __UINT32_MAX__
  108. #endif
  109. #ifdef __INT64_MAX__
  110. # undef INT64_MAX
  111. # define INT64_MAX __INT64_MAX__
  112. # undef INT64_MIN
  113. # define INT64_MIN (-INT64_MAX - 1)
  114. #endif
  115. #ifdef __UINT64_MAX__
  116. # undef UINT64_MAX
  117. # define UINT64_MAX __UINT64_MAX__
  118. #endif
  119. #undef INT_LEAST8_MAX
  120. #define INT_LEAST8_MAX __INT_LEAST8_MAX__
  121. #undef INT_LEAST8_MIN
  122. #define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1)
  123. #undef UINT_LEAST8_MAX
  124. #define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
  125. #undef INT_LEAST16_MAX
  126. #define INT_LEAST16_MAX __INT_LEAST16_MAX__
  127. #undef INT_LEAST16_MIN
  128. #define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1)
  129. #undef UINT_LEAST16_MAX
  130. #define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
  131. #undef INT_LEAST32_MAX
  132. #define INT_LEAST32_MAX __INT_LEAST32_MAX__
  133. #undef INT_LEAST32_MIN
  134. #define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)
  135. #undef UINT_LEAST32_MAX
  136. #define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
  137. #undef INT_LEAST64_MAX
  138. #define INT_LEAST64_MAX __INT_LEAST64_MAX__
  139. #undef INT_LEAST64_MIN
  140. #define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1)
  141. #undef UINT_LEAST64_MAX
  142. #define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
  143. #undef INT_FAST8_MAX
  144. #define INT_FAST8_MAX __INT_FAST8_MAX__
  145. #undef INT_FAST8_MIN
  146. #define INT_FAST8_MIN (-INT_FAST8_MAX - 1)
  147. #undef UINT_FAST8_MAX
  148. #define UINT_FAST8_MAX __UINT_FAST8_MAX__
  149. #undef INT_FAST16_MAX
  150. #define INT_FAST16_MAX __INT_FAST16_MAX__
  151. #undef INT_FAST16_MIN
  152. #define INT_FAST16_MIN (-INT_FAST16_MAX - 1)
  153. #undef UINT_FAST16_MAX
  154. #define UINT_FAST16_MAX __UINT_FAST16_MAX__
  155. #undef INT_FAST32_MAX
  156. #define INT_FAST32_MAX __INT_FAST32_MAX__
  157. #undef INT_FAST32_MIN
  158. #define INT_FAST32_MIN (-INT_FAST32_MAX - 1)
  159. #undef UINT_FAST32_MAX
  160. #define UINT_FAST32_MAX __UINT_FAST32_MAX__
  161. #undef INT_FAST64_MAX
  162. #define INT_FAST64_MAX __INT_FAST64_MAX__
  163. #undef INT_FAST64_MIN
  164. #define INT_FAST64_MIN (-INT_FAST64_MAX - 1)
  165. #undef UINT_FAST64_MAX
  166. #define UINT_FAST64_MAX __UINT_FAST64_MAX__
  167. #ifdef __INTPTR_MAX__
  168. # undef INTPTR_MAX
  169. # define INTPTR_MAX __INTPTR_MAX__
  170. # undef INTPTR_MIN
  171. # define INTPTR_MIN (-INTPTR_MAX - 1)
  172. #endif
  173. #ifdef __UINTPTR_MAX__
  174. # undef UINTPTR_MAX
  175. # define UINTPTR_MAX __UINTPTR_MAX__
  176. #endif
  177. #undef INTMAX_MAX
  178. #define INTMAX_MAX __INTMAX_MAX__
  179. #undef INTMAX_MIN
  180. #define INTMAX_MIN (-INTMAX_MAX - 1)
  181. #undef UINTMAX_MAX
  182. #define UINTMAX_MAX __UINTMAX_MAX__
  183. /* 7.18.3 Limits of other integer types */
  184. #undef PTRDIFF_MAX
  185. #define PTRDIFF_MAX __PTRDIFF_MAX__
  186. #undef PTRDIFF_MIN
  187. #define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
  188. #undef SIG_ATOMIC_MAX
  189. #define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
  190. #undef SIG_ATOMIC_MIN
  191. #define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__
  192. #undef SIZE_MAX
  193. #define SIZE_MAX __SIZE_MAX__
  194. #undef WCHAR_MAX
  195. #define WCHAR_MAX __WCHAR_MAX__
  196. #undef WCHAR_MIN
  197. #define WCHAR_MIN __WCHAR_MIN__
  198. #undef WINT_MAX
  199. #define WINT_MAX __WINT_MAX__
  200. #undef WINT_MIN
  201. #define WINT_MIN __WINT_MIN__
  202. #endif /* (!defined __cplusplus || __cplusplus >= 201103L
  203. || defined __STDC_LIMIT_MACROS) */
  204. #if (!defined __cplusplus || __cplusplus >= 201103L \
  205. || defined __STDC_CONSTANT_MACROS)
  206. #undef INT8_C
  207. #define INT8_C(c) __INT8_C(c)
  208. #undef INT16_C
  209. #define INT16_C(c) __INT16_C(c)
  210. #undef INT32_C
  211. #define INT32_C(c) __INT32_C(c)
  212. #undef INT64_C
  213. #define INT64_C(c) __INT64_C(c)
  214. #undef UINT8_C
  215. #define UINT8_C(c) __UINT8_C(c)
  216. #undef UINT16_C
  217. #define UINT16_C(c) __UINT16_C(c)
  218. #undef UINT32_C
  219. #define UINT32_C(c) __UINT32_C(c)
  220. #undef UINT64_C
  221. #define UINT64_C(c) __UINT64_C(c)
  222. #undef INTMAX_C
  223. #define INTMAX_C(c) __INTMAX_C(c)
  224. #undef UINTMAX_C
  225. #define UINTMAX_C(c) __UINTMAX_C(c)
  226. #endif /* (!defined __cplusplus || __cplusplus >= 201103L
  227. || defined __STDC_CONSTANT_MACROS) */
  228. #endif /* _GCC_STDINT_H */