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