24 #define OPAL_STDINT_H 1
31 #ifdef HAVE_SYS_TYPES_H
32 #include <sys/types.h>
40 typedef signed char int8_t;
44 typedef unsigned char uint8_t;
49 #error Failed to define 8-bit types
58 typedef signed short int16_t;
62 typedef unsigned short uint16_t;
67 #error Failed to define 16-bit types
76 typedef signed int int32_t;
80 typedef unsigned int uint32_t;
83 #elif SIZEOF_LONG == 4
86 typedef signed long int32_t;
90 typedef unsigned long uint32_t;
95 #error Failed to define 32-bit types
104 typedef signed int int64_t;
107 #ifndef HAVE_UINT64_T
108 typedef unsigned int uint64_t;
111 #elif SIZEOF_LONG == 8
114 typedef signed long int64_t;
117 #ifndef HAVE_UINT64_T
118 typedef unsigned long uint64_t;
121 #elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
124 typedef signed long long int64_t;
127 #ifndef HAVE_UINT64_T
128 typedef unsigned long long uint64_t;
133 #error Failed to define 64-bit types
139 #if SIZEOF_VOID_P == SIZEOF_INT
141 #ifndef HAVE_INTPTR_T
142 typedef signed int intptr_t;
145 #ifndef HAVE_UINTPTR_T
146 typedef unsigned int uintptr_t;
149 #elif SIZEOF_VOID_P == SIZEOF_LONG
151 #ifndef HAVE_INTPTR_T
152 typedef signed long intptr_t;
155 #ifndef HAVE_UINTPTR_T
156 typedef unsigned long uintptr_t;
159 #elif HAVE_LONG_LONG && SIZEOF_VOID_P == SIZEOF_LONG_LONG
161 #ifndef HAVE_INTPTR_T
162 typedef signed long long intptr_t;
164 #ifndef HAVE_UINTPTR_T
165 typedef unsigned long long uintptr_t;
170 #error Failed to define pointer-sized integer types
176 # if SIZEOF_VOID_P == SIZEOF_INT
177 # define SIZE_MAX UINT_MAX
178 # elif SIZEOF_VOID_P == SIZEOF_LONG
179 # define SIZE_MAX ULONG_MAX
181 # error Failed to find value for SIZE_MAX
187 #ifdef HAVE_INTTYPES_H
188 # include <inttypes.h>
191 # if SIZEOF_LONG == 8
192 # define __PRI64_PREFIX "l"
193 # define __PRIPTR_PREFIX "l"
195 # define __PRI64_PREFIX "ll"
196 # define __PRIPTR_PREFIX
203 # define PRId64 __PRI64_PREFIX "d"
205 # define PRIdLEAST8 "d"
206 # define PRIdLEAST16 "d"
207 # define PRIdLEAST32 "d"
208 # define PRIdLEAST64 __PRI64_PREFIX "d"
210 # define PRIdFAST8 "d"
211 # define PRIdFAST16 __PRIPTR_PREFIX "d"
212 # define PRIdFAST32 __PRIPTR_PREFIX "d"
213 # define PRIdFAST64 __PRI64_PREFIX "d"
218 # define PRIi64 __PRI64_PREFIX "i"
220 # define PRIiLEAST8 "i"
221 # define PRIiLEAST16 "i"
222 # define PRIiLEAST32 "i"
223 # define PRIiLEAST64 __PRI64_PREFIX "i"
225 # define PRIiFAST8 "i"
226 # define PRIiFAST16 __PRIPTR_PREFIX "i"
227 # define PRIiFAST32 __PRIPTR_PREFIX "i"
228 # define PRIiFAST64 __PRI64_PREFIX "i"
234 # define PRIo64 __PRI64_PREFIX "o"
236 # define PRIoLEAST8 "o"
237 # define PRIoLEAST16 "o"
238 # define PRIoLEAST32 "o"
239 # define PRIoLEAST64 __PRI64_PREFIX "o"
241 # define PRIoFAST8 "o"
242 # define PRIoFAST16 __PRIPTR_PREFIX "o"
243 # define PRIoFAST32 __PRIPTR_PREFIX "o"
244 # define PRIoFAST64 __PRI64_PREFIX "o"
250 # define PRIu64 __PRI64_PREFIX "u"
252 # define PRIuLEAST8 "u"
253 # define PRIuLEAST16 "u"
254 # define PRIuLEAST32 "u"
255 # define PRIuLEAST64 __PRI64_PREFIX "u"
257 # define PRIuFAST8 "u"
258 # define PRIuFAST16 __PRIPTR_PREFIX "u"
259 # define PRIuFAST32 __PRIPTR_PREFIX "u"
260 # define PRIuFAST64 __PRI64_PREFIX "u"
266 # define PRIx64 __PRI64_PREFIX "x"
268 # define PRIxLEAST8 "x"
269 # define PRIxLEAST16 "x"
270 # define PRIxLEAST32 "x"
271 # define PRIxLEAST64 __PRI64_PREFIX "x"
273 # define PRIxFAST8 "x"
274 # define PRIxFAST16 __PRIPTR_PREFIX "x"
275 # define PRIxFAST32 __PRIPTR_PREFIX "x"
276 # define PRIxFAST64 __PRI64_PREFIX "x"
282 # define PRIX64 __PRI64_PREFIX "X"
284 # define PRIXLEAST8 "X"
285 # define PRIXLEAST16 "X"
286 # define PRIXLEAST32 "X"
287 # define PRIXLEAST64 __PRI64_PREFIX "X"
289 # define PRIXFAST8 "X"
290 # define PRIXFAST16 __PRIPTR_PREFIX "X"
291 # define PRIXFAST32 __PRIPTR_PREFIX "X"
292 # define PRIXFAST64 __PRI64_PREFIX "X"
295 # define PRIdMAX __PRI64_PREFIX "d"
296 # define PRIiMAX __PRI64_PREFIX "i"
297 # define PRIoMAX __PRI64_PREFIX "o"
298 # define PRIuMAX __PRI64_PREFIX "u"
299 # define PRIxMAX __PRI64_PREFIX "x"
300 # define PRIXMAX __PRI64_PREFIX "X"
303 # define PRIdPTR __PRIPTR_PREFIX "d"
304 # define PRIiPTR __PRIPTR_PREFIX "i"
305 # define PRIoPTR __PRIPTR_PREFIX "o"
306 # define PRIuPTR __PRIPTR_PREFIX "u"
307 # define PRIxPTR __PRIPTR_PREFIX "x"
308 # define PRIXPTR __PRIPTR_PREFIX "X"
313 # if defined(ACCEPT_C99)
314 # define PRIsize_t "zu"
315 # elif SIZEOF_SIZE_T == SIZEOF_LONG
316 # define PRIsize_t "lu"
317 # elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
318 # define PRIsize_t "llu"
320 # define PRIsize_t "u"