stdint.in.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  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. /* If the system defines INTMAX_MAX, assume that intmax_t works, and
  233. similarly for UINTMAX_MAX and uintmax_t. This avoids problems with
  234. assuming one type where another is used by the system. */
  235. #ifndef INTMAX_MAX
  236. # undef INTMAX_C
  237. # undef intmax_t
  238. # if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
  239. typedef long long int gl_intmax_t;
  240. # define intmax_t gl_intmax_t
  241. # elif defined GL_INT64_T
  242. # define intmax_t int64_t
  243. # else
  244. typedef long int gl_intmax_t;
  245. # define intmax_t gl_intmax_t
  246. # endif
  247. #endif
  248. #ifndef UINTMAX_MAX
  249. # undef UINTMAX_C
  250. # undef uintmax_t
  251. # if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
  252. typedef unsigned long long int gl_uintmax_t;
  253. # define uintmax_t gl_uintmax_t
  254. # elif defined GL_UINT64_T
  255. # define uintmax_t uint64_t
  256. # else
  257. typedef unsigned long int gl_uintmax_t;
  258. # define uintmax_t gl_uintmax_t
  259. # endif
  260. #endif
  261. /* Verify that intmax_t and uintmax_t have the same size. Too much code
  262. breaks if this is not the case. If this check fails, the reason is likely
  263. to be found in the autoconf macros. */
  264. typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
  265. ? 1 : -1];
  266. #define GNULIB_defined_stdint_types 1
  267. #endif /* !GNULIB_defined_stdint_types */
  268. /* 7.18.2. Limits of specified-width integer types */
  269. #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
  270. /* 7.18.2.1. Limits of exact-width integer types */
  271. /* Here we assume a standard architecture where the hardware integer
  272. types have 8, 16, 32, optionally 64 bits. */
  273. #undef INT8_MIN
  274. #undef INT8_MAX
  275. #undef UINT8_MAX
  276. #define INT8_MIN (~ INT8_MAX)
  277. #define INT8_MAX 127
  278. #define UINT8_MAX 255
  279. #undef INT16_MIN
  280. #undef INT16_MAX
  281. #undef UINT16_MAX
  282. #define INT16_MIN (~ INT16_MAX)
  283. #define INT16_MAX 32767
  284. #define UINT16_MAX 65535
  285. #undef INT32_MIN
  286. #undef INT32_MAX
  287. #undef UINT32_MAX
  288. #define INT32_MIN (~ INT32_MAX)
  289. #define INT32_MAX 2147483647
  290. #define UINT32_MAX 4294967295U
  291. #if defined GL_INT64_T && ! defined INT64_MAX
  292. /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
  293. evaluates the latter incorrectly in preprocessor expressions. */
  294. # define INT64_MIN (- INTMAX_C (1) << 63)
  295. # define INT64_MAX INTMAX_C (9223372036854775807)
  296. #endif
  297. #if defined GL_UINT64_T && ! defined UINT64_MAX
  298. # define UINT64_MAX UINTMAX_C (18446744073709551615)
  299. #endif
  300. /* 7.18.2.2. Limits of minimum-width integer types */
  301. /* Here we assume a standard architecture where the hardware integer
  302. types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
  303. are the same as the corresponding N_t types. */
  304. #undef INT_LEAST8_MIN
  305. #undef INT_LEAST8_MAX
  306. #undef UINT_LEAST8_MAX
  307. #define INT_LEAST8_MIN INT8_MIN
  308. #define INT_LEAST8_MAX INT8_MAX
  309. #define UINT_LEAST8_MAX UINT8_MAX
  310. #undef INT_LEAST16_MIN
  311. #undef INT_LEAST16_MAX
  312. #undef UINT_LEAST16_MAX
  313. #define INT_LEAST16_MIN INT16_MIN
  314. #define INT_LEAST16_MAX INT16_MAX
  315. #define UINT_LEAST16_MAX UINT16_MAX
  316. #undef INT_LEAST32_MIN
  317. #undef INT_LEAST32_MAX
  318. #undef UINT_LEAST32_MAX
  319. #define INT_LEAST32_MIN INT32_MIN
  320. #define INT_LEAST32_MAX INT32_MAX
  321. #define UINT_LEAST32_MAX UINT32_MAX
  322. #undef INT_LEAST64_MIN
  323. #undef INT_LEAST64_MAX
  324. #ifdef GL_INT64_T
  325. # define INT_LEAST64_MIN INT64_MIN
  326. # define INT_LEAST64_MAX INT64_MAX
  327. #endif
  328. #undef UINT_LEAST64_MAX
  329. #ifdef GL_UINT64_T
  330. # define UINT_LEAST64_MAX UINT64_MAX
  331. #endif
  332. /* 7.18.2.3. Limits of fastest minimum-width integer types */
  333. /* Here we assume a standard architecture where the hardware integer
  334. types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
  335. are taken from the same list of types. */
  336. #undef INT_FAST8_MIN
  337. #undef INT_FAST8_MAX
  338. #undef UINT_FAST8_MAX
  339. #define INT_FAST8_MIN LONG_MIN
  340. #define INT_FAST8_MAX LONG_MAX
  341. #define UINT_FAST8_MAX ULONG_MAX
  342. #undef INT_FAST16_MIN
  343. #undef INT_FAST16_MAX
  344. #undef UINT_FAST16_MAX
  345. #define INT_FAST16_MIN LONG_MIN
  346. #define INT_FAST16_MAX LONG_MAX
  347. #define UINT_FAST16_MAX ULONG_MAX
  348. #undef INT_FAST32_MIN
  349. #undef INT_FAST32_MAX
  350. #undef UINT_FAST32_MAX
  351. #define INT_FAST32_MIN LONG_MIN
  352. #define INT_FAST32_MAX LONG_MAX
  353. #define UINT_FAST32_MAX ULONG_MAX
  354. #undef INT_FAST64_MIN
  355. #undef INT_FAST64_MAX
  356. #ifdef GL_INT64_T
  357. # define INT_FAST64_MIN INT64_MIN
  358. # define INT_FAST64_MAX INT64_MAX
  359. #endif
  360. #undef UINT_FAST64_MAX
  361. #ifdef GL_UINT64_T
  362. # define UINT_FAST64_MAX UINT64_MAX
  363. #endif
  364. /* 7.18.2.4. Limits of integer types capable of holding object pointers */
  365. #undef INTPTR_MIN
  366. #undef INTPTR_MAX
  367. #undef UINTPTR_MAX
  368. #define INTPTR_MIN LONG_MIN
  369. #define INTPTR_MAX LONG_MAX
  370. #define UINTPTR_MAX ULONG_MAX
  371. /* 7.18.2.5. Limits of greatest-width integer types */
  372. #ifndef INTMAX_MAX
  373. # undef INTMAX_MIN
  374. # ifdef INT64_MAX
  375. # define INTMAX_MIN INT64_MIN
  376. # define INTMAX_MAX INT64_MAX
  377. # else
  378. # define INTMAX_MIN INT32_MIN
  379. # define INTMAX_MAX INT32_MAX
  380. # endif
  381. #endif
  382. #ifndef UINTMAX_MAX
  383. # ifdef UINT64_MAX
  384. # define UINTMAX_MAX UINT64_MAX
  385. # else
  386. # define UINTMAX_MAX UINT32_MAX
  387. # endif
  388. #endif
  389. /* 7.18.3. Limits of other integer types */
  390. /* ptrdiff_t limits */
  391. #undef PTRDIFF_MIN
  392. #undef PTRDIFF_MAX
  393. #if @APPLE_UNIVERSAL_BUILD@
  394. # ifdef _LP64
  395. # define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l)
  396. # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l)
  397. # else
  398. # define PTRDIFF_MIN _STDINT_MIN (1, 32, 0)
  399. # define PTRDIFF_MAX _STDINT_MAX (1, 32, 0)
  400. # endif
  401. #else
  402. # define PTRDIFF_MIN \
  403. _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
  404. # define PTRDIFF_MAX \
  405. _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
  406. #endif
  407. /* sig_atomic_t limits */
  408. #undef SIG_ATOMIC_MIN
  409. #undef SIG_ATOMIC_MAX
  410. #define SIG_ATOMIC_MIN \
  411. _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
  412. 0@SIG_ATOMIC_T_SUFFIX@)
  413. #define SIG_ATOMIC_MAX \
  414. _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
  415. 0@SIG_ATOMIC_T_SUFFIX@)
  416. /* size_t limit */
  417. #undef SIZE_MAX
  418. #if @APPLE_UNIVERSAL_BUILD@
  419. # ifdef _LP64
  420. # define SIZE_MAX _STDINT_MAX (0, 64, 0ul)
  421. # else
  422. # define SIZE_MAX _STDINT_MAX (0, 32, 0ul)
  423. # endif
  424. #else
  425. # define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
  426. #endif
  427. /* wchar_t limits */
  428. /* Get WCHAR_MIN, WCHAR_MAX.
  429. This include is not on the top, above, because on OSF/1 4.0 we have a
  430. sequence of nested includes
  431. <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
  432. <stdint.h> and assumes its types are already defined. */
  433. #if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
  434. /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
  435. included before <wchar.h>. */
  436. # include <stddef.h>
  437. # include <stdio.h>
  438. # include <time.h>
  439. # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
  440. # include <wchar.h>
  441. # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
  442. #endif
  443. #undef WCHAR_MIN
  444. #undef WCHAR_MAX
  445. #define WCHAR_MIN \
  446. _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
  447. #define WCHAR_MAX \
  448. _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
  449. /* wint_t limits */
  450. #undef WINT_MIN
  451. #undef WINT_MAX
  452. #define WINT_MIN \
  453. _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
  454. #define WINT_MAX \
  455. _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
  456. #endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
  457. /* 7.18.4. Macros for integer constants */
  458. #if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
  459. /* 7.18.4.1. Macros for minimum-width integer constants */
  460. /* According to ISO C 99 Technical Corrigendum 1 */
  461. /* Here we assume a standard architecture where the hardware integer
  462. types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
  463. #undef INT8_C
  464. #undef UINT8_C
  465. #define INT8_C(x) x
  466. #define UINT8_C(x) x
  467. #undef INT16_C
  468. #undef UINT16_C
  469. #define INT16_C(x) x
  470. #define UINT16_C(x) x
  471. #undef INT32_C
  472. #undef UINT32_C
  473. #define INT32_C(x) x
  474. #define UINT32_C(x) x ## U
  475. #undef INT64_C
  476. #undef UINT64_C
  477. #if LONG_MAX >> 31 >> 31 == 1
  478. # define INT64_C(x) x##L
  479. #elif defined _MSC_VER
  480. # define INT64_C(x) x##i64
  481. #elif @HAVE_LONG_LONG_INT@
  482. # define INT64_C(x) x##LL
  483. #endif
  484. #if ULONG_MAX >> 31 >> 31 >> 1 == 1
  485. # define UINT64_C(x) x##UL
  486. #elif defined _MSC_VER
  487. # define UINT64_C(x) x##ui64
  488. #elif @HAVE_UNSIGNED_LONG_LONG_INT@
  489. # define UINT64_C(x) x##ULL
  490. #endif
  491. /* 7.18.4.2. Macros for greatest-width integer constants */
  492. #ifndef INTMAX_C
  493. # if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
  494. # define INTMAX_C(x) x##LL
  495. # elif defined GL_INT64_T
  496. # define INTMAX_C(x) INT64_C(x)
  497. # else
  498. # define INTMAX_C(x) x##L
  499. # endif
  500. #endif
  501. #ifndef UINTMAX_C
  502. # if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
  503. # define UINTMAX_C(x) x##ULL
  504. # elif defined GL_UINT64_T
  505. # define UINTMAX_C(x) UINT64_C(x)
  506. # else
  507. # define UINTMAX_C(x) x##UL
  508. # endif
  509. #endif
  510. #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
  511. #endif /* _@GUARD_PREFIX@_STDINT_H */
  512. #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */