stdint.in.h 16 KB

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