stdint.in.h 17 KB

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