stdint.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /* Copyright (C) ARM Ltd., 1999 */
  2. /* All rights reserved */
  3. /*
  4. * RCS $Revision: 178085 $
  5. * Checkin $Date: 2012-12-11 14:54:17 +0000 (Tue, 11 Dec 2012) $
  6. * Revising $Author: agrant $
  7. */
  8. #ifndef __stdint_h
  9. #define __stdint_h
  10. #define __ARMCLIB_VERSION 5030076
  11. #ifndef __STDINT_DECLS
  12. #define __STDINT_DECLS
  13. #undef __CLIBNS
  14. #ifdef __cplusplus
  15. namespace std {
  16. #define __CLIBNS std::
  17. extern "C" {
  18. #else
  19. #define __CLIBNS
  20. #endif /* __cplusplus */
  21. /*
  22. * 'signed' is redundant below, except for 'signed char' and if
  23. * the typedef is used to declare a bitfield.
  24. * '__int64' is used instead of 'long long' so that this header
  25. * can be used in --strict mode.
  26. */
  27. /* 7.18.1.1 */
  28. /* exact-width signed integer types */
  29. typedef signed char int8_t;
  30. typedef signed short int int16_t;
  31. typedef signed int int32_t;
  32. typedef signed __int64 int64_t;
  33. /* exact-width unsigned integer types */
  34. typedef unsigned char uint8_t;
  35. typedef unsigned short int uint16_t;
  36. typedef unsigned int uint32_t;
  37. typedef unsigned __int64 uint64_t;
  38. /* 7.18.1.2 */
  39. /* smallest type of at least n bits */
  40. /* minimum-width signed integer types */
  41. typedef signed char int_least8_t;
  42. typedef signed short int int_least16_t;
  43. typedef signed int int_least32_t;
  44. typedef signed __int64 int_least64_t;
  45. /* minimum-width unsigned integer types */
  46. typedef unsigned char uint_least8_t;
  47. typedef unsigned short int uint_least16_t;
  48. typedef unsigned int uint_least32_t;
  49. typedef unsigned __int64 uint_least64_t;
  50. /* 7.18.1.3 */
  51. /* fastest minimum-width signed integer types */
  52. typedef signed int int_fast8_t;
  53. typedef signed int int_fast16_t;
  54. typedef signed int int_fast32_t;
  55. typedef signed __int64 int_fast64_t;
  56. /* fastest minimum-width unsigned integer types */
  57. typedef unsigned int uint_fast8_t;
  58. typedef unsigned int uint_fast16_t;
  59. typedef unsigned int uint_fast32_t;
  60. typedef unsigned __int64 uint_fast64_t;
  61. /* 7.18.1.4 integer types capable of holding object pointers */
  62. typedef signed int intptr_t;
  63. typedef unsigned int uintptr_t;
  64. /* 7.18.1.5 greatest-width integer types */
  65. typedef signed __int64 intmax_t;
  66. typedef unsigned __int64 uintmax_t;
  67. #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
  68. /* 7.18.2.1 */
  69. /* minimum values of exact-width signed integer types */
  70. #define INT8_MIN -128
  71. #define INT16_MIN -32768
  72. #define INT32_MIN (~0x7fffffff) /* -2147483648 is unsigned */
  73. #define INT64_MIN __ESCAPE__(~0x7fffffffffffffffll) /* -9223372036854775808 is unsigned */
  74. /* maximum values of exact-width signed integer types */
  75. #define INT8_MAX 127
  76. #define INT16_MAX 32767
  77. #define INT32_MAX 2147483647
  78. #define INT64_MAX __ESCAPE__(9223372036854775807ll)
  79. /* maximum values of exact-width unsigned integer types */
  80. #define UINT8_MAX 255
  81. #define UINT16_MAX 65535
  82. #define UINT32_MAX 4294967295u
  83. #define UINT64_MAX __ESCAPE__(18446744073709551615ull)
  84. /* 7.18.2.2 */
  85. /* minimum values of minimum-width signed integer types */
  86. #define INT_LEAST8_MIN -128
  87. #define INT_LEAST16_MIN -32768
  88. #define INT_LEAST32_MIN (~0x7fffffff)
  89. #define INT_LEAST64_MIN __ESCAPE__(~0x7fffffffffffffffll)
  90. /* maximum values of minimum-width signed integer types */
  91. #define INT_LEAST8_MAX 127
  92. #define INT_LEAST16_MAX 32767
  93. #define INT_LEAST32_MAX 2147483647
  94. #define INT_LEAST64_MAX __ESCAPE__(9223372036854775807ll)
  95. /* maximum values of minimum-width unsigned integer types */
  96. #define UINT_LEAST8_MAX 255
  97. #define UINT_LEAST16_MAX 65535
  98. #define UINT_LEAST32_MAX 4294967295u
  99. #define UINT_LEAST64_MAX __ESCAPE__(18446744073709551615ull)
  100. /* 7.18.2.3 */
  101. /* minimum values of fastest minimum-width signed integer types */
  102. #define INT_FAST8_MIN (~0x7fffffff)
  103. #define INT_FAST16_MIN (~0x7fffffff)
  104. #define INT_FAST32_MIN (~0x7fffffff)
  105. #define INT_FAST64_MIN __ESCAPE__(~0x7fffffffffffffffll)
  106. /* maximum values of fastest minimum-width signed integer types */
  107. #define INT_FAST8_MAX 2147483647
  108. #define INT_FAST16_MAX 2147483647
  109. #define INT_FAST32_MAX 2147483647
  110. #define INT_FAST64_MAX __ESCAPE__(9223372036854775807ll)
  111. /* maximum values of fastest minimum-width unsigned integer types */
  112. #define UINT_FAST8_MAX 4294967295u
  113. #define UINT_FAST16_MAX 4294967295u
  114. #define UINT_FAST32_MAX 4294967295u
  115. #define UINT_FAST64_MAX __ESCAPE__(18446744073709551615ull)
  116. /* 7.18.2.4 */
  117. /* minimum value of pointer-holding signed integer type */
  118. #define INTPTR_MIN (~0x7fffffff)
  119. /* maximum value of pointer-holding signed integer type */
  120. #define INTPTR_MAX 2147483647
  121. /* maximum value of pointer-holding unsigned integer type */
  122. #define UINTPTR_MAX 4294967295u
  123. /* 7.18.2.5 */
  124. /* minimum value of greatest-width signed integer type */
  125. #define INTMAX_MIN __ESCAPE__(~0x7fffffffffffffffll)
  126. /* maximum value of greatest-width signed integer type */
  127. #define INTMAX_MAX __ESCAPE__(9223372036854775807ll)
  128. /* maximum value of greatest-width unsigned integer type */
  129. #define UINTMAX_MAX __ESCAPE__(18446744073709551615ull)
  130. /* 7.18.3 */
  131. /* limits of ptrdiff_t */
  132. #define PTRDIFF_MIN (~0x7fffffff)
  133. #define PTRDIFF_MAX 2147483647
  134. /* limits of sig_atomic_t */
  135. #define SIG_ATOMIC_MIN (~0x7fffffff)
  136. #define SIG_ATOMIC_MAX 2147483647
  137. /* limit of size_t */
  138. #define SIZE_MAX 4294967295u
  139. /* limits of wchar_t */
  140. /* NB we have to undef and redef because they're defined in both
  141. * stdint.h and wchar.h */
  142. #undef WCHAR_MIN
  143. #undef WCHAR_MAX
  144. #if defined(__WCHAR32)
  145. #define WCHAR_MIN 0
  146. #define WCHAR_MAX 0xffffffffU
  147. #else
  148. #define WCHAR_MIN 0
  149. #define WCHAR_MAX 65535
  150. #endif
  151. /* limits of wint_t */
  152. #define WINT_MIN (~0x7fffffff)
  153. #define WINT_MAX 2147483647
  154. #endif /* __STDC_LIMIT_MACROS */
  155. #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
  156. /* 7.18.4.1 macros for minimum-width integer constants */
  157. #define INT8_C(x) (x)
  158. #define INT16_C(x) (x)
  159. #define INT32_C(x) (x)
  160. #define INT64_C(x) __ESCAPE__(x ## ll)
  161. #define UINT8_C(x) (x ## u)
  162. #define UINT16_C(x) (x ## u)
  163. #define UINT32_C(x) (x ## u)
  164. #define UINT64_C(x) __ESCAPE__(x ## ull)
  165. /* 7.18.4.2 macros for greatest-width integer constants */
  166. #define INTMAX_C(x) __ESCAPE__(x ## ll)
  167. #define UINTMAX_C(x) __ESCAPE__(x ## ull)
  168. #endif /* __STDC_CONSTANT_MACROS */
  169. #ifdef __cplusplus
  170. } /* extern "C" */
  171. } /* namespace std */
  172. #endif /* __cplusplus */
  173. #endif /* __STDINT_DECLS */
  174. #ifdef __cplusplus
  175. #ifndef __STDINT_NO_EXPORTS
  176. using ::std::int8_t;
  177. using ::std::int16_t;
  178. using ::std::int32_t;
  179. using ::std::int64_t;
  180. using ::std::uint8_t;
  181. using ::std::uint16_t;
  182. using ::std::uint32_t;
  183. using ::std::uint64_t;
  184. using ::std::int_least8_t;
  185. using ::std::int_least16_t;
  186. using ::std::int_least32_t;
  187. using ::std::int_least64_t;
  188. using ::std::uint_least8_t;
  189. using ::std::uint_least16_t;
  190. using ::std::uint_least32_t;
  191. using ::std::uint_least64_t;
  192. using ::std::int_fast8_t;
  193. using ::std::int_fast16_t;
  194. using ::std::int_fast32_t;
  195. using ::std::int_fast64_t;
  196. using ::std::uint_fast8_t;
  197. using ::std::uint_fast16_t;
  198. using ::std::uint_fast32_t;
  199. using ::std::uint_fast64_t;
  200. using ::std::intptr_t;
  201. using ::std::uintptr_t;
  202. using ::std::intmax_t;
  203. using ::std::uintmax_t;
  204. #endif
  205. #endif /* __cplusplus */
  206. #endif /* __stdint_h */
  207. /* end of stdint.h */