4
0

stdint.in.h 18 KB

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