stdint.in.h 18 KB

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