stdint.in.h 17 KB

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