inttypes.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. #ifndef _INTTYPES_H
  2. #define _INTTYPES_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #include <stdint.h>
  8. #define __NEED_wchar_t
  9. #include <bits/alltypes.h>
  10. typedef struct { intmax_t quot, rem; } imaxdiv_t;
  11. intmax_t imaxabs(intmax_t);
  12. imaxdiv_t imaxdiv(intmax_t, intmax_t);
  13. intmax_t strtoimax(const char *__restrict, char **__restrict, int);
  14. uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
  15. intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
  16. uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
  17. #if UINTPTR_MAX == UINT64_MAX
  18. #define __PRI64 "l"
  19. #define __PRIPTR "l"
  20. #else
  21. #define __PRI64 "ll"
  22. #define __PRIPTR ""
  23. #endif
  24. #define PRId8 "d"
  25. #define PRId16 "d"
  26. #define PRId32 "d"
  27. #define PRId64 __PRI64 "d"
  28. #define PRIdLEAST8 "d"
  29. #define PRIdLEAST16 "d"
  30. #define PRIdLEAST32 "d"
  31. #define PRIdLEAST64 __PRI64 "d"
  32. #define PRIdFAST8 "d"
  33. #define PRIdFAST16 "d"
  34. #define PRIdFAST32 "d"
  35. #define PRIdFAST64 __PRI64 "d"
  36. #define PRIi8 "i"
  37. #define PRIi16 "i"
  38. #define PRIi32 "i"
  39. #define PRIi64 __PRI64 "i"
  40. #define PRIiLEAST8 "i"
  41. #define PRIiLEAST16 "i"
  42. #define PRIiLEAST32 "i"
  43. #define PRIiLEAST64 __PRI64 "i"
  44. #define PRIiFAST8 "i"
  45. #define PRIiFAST16 "i"
  46. #define PRIiFAST32 "i"
  47. #define PRIiFAST64 __PRI64 "i"
  48. #define PRIo8 "o"
  49. #define PRIo16 "o"
  50. #define PRIo32 "o"
  51. #define PRIo64 __PRI64 "o"
  52. #define PRIoLEAST8 "o"
  53. #define PRIoLEAST16 "o"
  54. #define PRIoLEAST32 "o"
  55. #define PRIoLEAST64 __PRI64 "o"
  56. #define PRIoFAST8 "o"
  57. #define PRIoFAST16 "o"
  58. #define PRIoFAST32 "o"
  59. #define PRIoFAST64 __PRI64 "o"
  60. #define PRIu8 "u"
  61. #define PRIu16 "u"
  62. #define PRIu32 "u"
  63. #define PRIu64 __PRI64 "u"
  64. #define PRIuLEAST8 "u"
  65. #define PRIuLEAST16 "u"
  66. #define PRIuLEAST32 "u"
  67. #define PRIuLEAST64 __PRI64 "u"
  68. #define PRIuFAST8 "u"
  69. #define PRIuFAST16 "u"
  70. #define PRIuFAST32 "u"
  71. #define PRIuFAST64 __PRI64 "u"
  72. #define PRIx8 "x"
  73. #define PRIx16 "x"
  74. #define PRIx32 "x"
  75. #define PRIx64 __PRI64 "x"
  76. #define PRIxLEAST8 "x"
  77. #define PRIxLEAST16 "x"
  78. #define PRIxLEAST32 "x"
  79. #define PRIxLEAST64 __PRI64 "x"
  80. #define PRIxFAST8 "x"
  81. #define PRIxFAST16 "x"
  82. #define PRIxFAST32 "x"
  83. #define PRIxFAST64 __PRI64 "x"
  84. #define PRIX8 "X"
  85. #define PRIX16 "X"
  86. #define PRIX32 "X"
  87. #define PRIX64 __PRI64 "X"
  88. #define PRIXLEAST8 "X"
  89. #define PRIXLEAST16 "X"
  90. #define PRIXLEAST32 "X"
  91. #define PRIXLEAST64 __PRI64 "X"
  92. #define PRIXFAST8 "X"
  93. #define PRIXFAST16 "X"
  94. #define PRIXFAST32 "X"
  95. #define PRIXFAST64 __PRI64 "X"
  96. #define PRIdMAX __PRI64 "d"
  97. #define PRIiMAX __PRI64 "i"
  98. #define PRIoMAX __PRI64 "o"
  99. #define PRIuMAX __PRI64 "u"
  100. #define PRIxMAX __PRI64 "x"
  101. #define PRIXMAX __PRI64 "X"
  102. #define PRIdPTR __PRIPTR "d"
  103. #define PRIiPTR __PRIPTR "i"
  104. #define PRIoPTR __PRIPTR "o"
  105. #define PRIuPTR __PRIPTR "u"
  106. #define PRIxPTR __PRIPTR "x"
  107. #define PRIXPTR __PRIPTR "X"
  108. #define SCNd8 "hhd"
  109. #define SCNd16 "hd"
  110. #define SCNd32 "d"
  111. #define SCNd64 __PRI64 "d"
  112. #define SCNdLEAST8 "hhd"
  113. #define SCNdLEAST16 "hd"
  114. #define SCNdLEAST32 "d"
  115. #define SCNdLEAST64 __PRI64 "d"
  116. #define SCNdFAST8 "hhd"
  117. #define SCNdFAST16 "d"
  118. #define SCNdFAST32 "d"
  119. #define SCNdFAST64 __PRI64 "d"
  120. #define SCNi8 "hhi"
  121. #define SCNi16 "hi"
  122. #define SCNi32 "i"
  123. #define SCNi64 __PRI64 "i"
  124. #define SCNiLEAST8 "hhi"
  125. #define SCNiLEAST16 "hi"
  126. #define SCNiLEAST32 "i"
  127. #define SCNiLEAST64 __PRI64 "i"
  128. #define SCNiFAST8 "hhi"
  129. #define SCNiFAST16 "i"
  130. #define SCNiFAST32 "i"
  131. #define SCNiFAST64 __PRI64 "i"
  132. #define SCNu8 "hhu"
  133. #define SCNu16 "hu"
  134. #define SCNu32 "u"
  135. #define SCNu64 __PRI64 "u"
  136. #define SCNuLEAST8 "hhu"
  137. #define SCNuLEAST16 "hu"
  138. #define SCNuLEAST32 "u"
  139. #define SCNuLEAST64 __PRI64 "u"
  140. #define SCNuFAST8 "hhu"
  141. #define SCNuFAST16 "u"
  142. #define SCNuFAST32 "u"
  143. #define SCNuFAST64 __PRI64 "u"
  144. #define SCNo8 "hho"
  145. #define SCNo16 "ho"
  146. #define SCNo32 "o"
  147. #define SCNo64 __PRI64 "o"
  148. #define SCNoLEAST8 "hho"
  149. #define SCNoLEAST16 "ho"
  150. #define SCNoLEAST32 "o"
  151. #define SCNoLEAST64 __PRI64 "o"
  152. #define SCNoFAST8 "hho"
  153. #define SCNoFAST16 "o"
  154. #define SCNoFAST32 "o"
  155. #define SCNoFAST64 __PRI64 "o"
  156. #define SCNx8 "hhx"
  157. #define SCNx16 "hx"
  158. #define SCNx32 "x"
  159. #define SCNx64 __PRI64 "x"
  160. #define SCNxLEAST8 "hhx"
  161. #define SCNxLEAST16 "hx"
  162. #define SCNxLEAST32 "x"
  163. #define SCNxLEAST64 __PRI64 "x"
  164. #define SCNxFAST8 "hhx"
  165. #define SCNxFAST16 "x"
  166. #define SCNxFAST32 "x"
  167. #define SCNxFAST64 __PRI64 "x"
  168. #define SCNdMAX __PRI64 "d"
  169. #define SCNiMAX __PRI64 "i"
  170. #define SCNoMAX __PRI64 "o"
  171. #define SCNuMAX __PRI64 "u"
  172. #define SCNxMAX __PRI64 "x"
  173. #define SCNdPTR __PRIPTR "d"
  174. #define SCNiPTR __PRIPTR "i"
  175. #define SCNoPTR __PRIPTR "o"
  176. #define SCNuPTR __PRIPTR "u"
  177. #define SCNxPTR __PRIPTR "x"
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif