2
0

stdint.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. /* Copyright (C) 2008-2018 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 _STDINT_H
  22. #define _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. #ifdef __STDC_WANT_IEC_60559_BFP_EXT__
  229. /* TS 18661-1 widths of integer types. */
  230. #ifdef __INT8_TYPE__
  231. # undef INT8_WIDTH
  232. # define INT8_WIDTH 8
  233. #endif
  234. #ifdef __UINT8_TYPE__
  235. # undef UINT8_WIDTH
  236. # define UINT8_WIDTH 8
  237. #endif
  238. #ifdef __INT16_TYPE__
  239. # undef INT16_WIDTH
  240. # define INT16_WIDTH 16
  241. #endif
  242. #ifdef __UINT16_TYPE__
  243. # undef UINT16_WIDTH
  244. # define UINT16_WIDTH 16
  245. #endif
  246. #ifdef __INT32_TYPE__
  247. # undef INT32_WIDTH
  248. # define INT32_WIDTH 32
  249. #endif
  250. #ifdef __UINT32_TYPE__
  251. # undef UINT32_WIDTH
  252. # define UINT32_WIDTH 32
  253. #endif
  254. #ifdef __INT64_TYPE__
  255. # undef INT64_WIDTH
  256. # define INT64_WIDTH 64
  257. #endif
  258. #ifdef __UINT64_TYPE__
  259. # undef UINT64_WIDTH
  260. # define UINT64_WIDTH 64
  261. #endif
  262. #undef INT_LEAST8_WIDTH
  263. #define INT_LEAST8_WIDTH __INT_LEAST8_WIDTH__
  264. #undef UINT_LEAST8_WIDTH
  265. #define UINT_LEAST8_WIDTH __INT_LEAST8_WIDTH__
  266. #undef INT_LEAST16_WIDTH
  267. #define INT_LEAST16_WIDTH __INT_LEAST16_WIDTH__
  268. #undef UINT_LEAST16_WIDTH
  269. #define UINT_LEAST16_WIDTH __INT_LEAST16_WIDTH__
  270. #undef INT_LEAST32_WIDTH
  271. #define INT_LEAST32_WIDTH __INT_LEAST32_WIDTH__
  272. #undef UINT_LEAST32_WIDTH
  273. #define UINT_LEAST32_WIDTH __INT_LEAST32_WIDTH__
  274. #undef INT_LEAST64_WIDTH
  275. #define INT_LEAST64_WIDTH __INT_LEAST64_WIDTH__
  276. #undef UINT_LEAST64_WIDTH
  277. #define UINT_LEAST64_WIDTH __INT_LEAST64_WIDTH__
  278. #undef INT_FAST8_WIDTH
  279. #define INT_FAST8_WIDTH __INT_FAST8_WIDTH__
  280. #undef UINT_FAST8_WIDTH
  281. #define UINT_FAST8_WIDTH __INT_FAST8_WIDTH__
  282. #undef INT_FAST16_WIDTH
  283. #define INT_FAST16_WIDTH __INT_FAST16_WIDTH__
  284. #undef UINT_FAST16_WIDTH
  285. #define UINT_FAST16_WIDTH __INT_FAST16_WIDTH__
  286. #undef INT_FAST32_WIDTH
  287. #define INT_FAST32_WIDTH __INT_FAST32_WIDTH__
  288. #undef UINT_FAST32_WIDTH
  289. #define UINT_FAST32_WIDTH __INT_FAST32_WIDTH__
  290. #undef INT_FAST64_WIDTH
  291. #define INT_FAST64_WIDTH __INT_FAST64_WIDTH__
  292. #undef UINT_FAST64_WIDTH
  293. #define UINT_FAST64_WIDTH __INT_FAST64_WIDTH__
  294. #ifdef __INTPTR_TYPE__
  295. # undef INTPTR_WIDTH
  296. # define INTPTR_WIDTH __INTPTR_WIDTH__
  297. #endif
  298. #ifdef __UINTPTR_TYPE__
  299. # undef UINTPTR_WIDTH
  300. # define UINTPTR_WIDTH __INTPTR_WIDTH__
  301. #endif
  302. #undef INTMAX_WIDTH
  303. #define INTMAX_WIDTH __INTMAX_WIDTH__
  304. #undef UINTMAX_WIDTH
  305. #define UINTMAX_WIDTH __INTMAX_WIDTH__
  306. #undef PTRDIFF_WIDTH
  307. #define PTRDIFF_WIDTH __PTRDIFF_WIDTH__
  308. #undef SIG_ATOMIC_WIDTH
  309. #define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__
  310. #undef SIZE_WIDTH
  311. #define SIZE_WIDTH __SIZE_WIDTH__
  312. #undef WCHAR_WIDTH
  313. #define WCHAR_WIDTH __WCHAR_WIDTH__
  314. #undef WINT_WIDTH
  315. #define WINT_WIDTH __WINT_WIDTH__
  316. #define SIZE_MAX UINT64_MAX
  317. #endif
  318. typedef long sig_atomic_t;
  319. #endif /* _GCC_STDINT_H */