Go to the documentation of this file. 25 #ifndef COMMON_TYPES_H 26 #define COMMON_TYPES_H 35 #ifdef HAVE_INTTYPES_H 37 #endif // HAVE_INTTYPES_H 40 #endif // HAVE_STDINT_H 41 #ifdef HAVE_SYS_TYPES_H 42 #include <sys/types.h> 43 #endif // HAVE_SYS_TYPES_H 45 #if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H) 49 #elif defined(HAVE_SYS_TYPES_H) 57 typedef u_int8_t uint8_t;
58 typedef u_int16_t uint16_t;
59 typedef u_int32_t uint32_t;
60 typedef u_int64_t uint64_t;
61 #elif defined(SIZEOF_CHAR) && \ 62 defined(SIZEOF_SHORT) && \ 63 defined(SIZEOF_INT) && \ 64 defined(SIZEOF_LONG) && \ 65 defined(SIZEOF_LONG_LONG) 71 typedef signed char int8_t;
72 typedef unsigned char uint8_t;
74 #error Cannot find an 8-bit integer type 78 typedef short int16_t;
79 typedef unsigned short uint16_t;
82 typedef unsigned int uint16_t;
84 #error Cannot find a 16-bit integer type 89 typedef unsigned int uint32_t;
90 #elif SIZEOF_LONG == 4 92 typedef unsigned long uint32_t;
94 #error Cannot find a 32-bit integer type 99 typedef unsigned long uint64_t;
100 #elif SIZEOF_LONG_LONG == 8 101 typedef long long int64_t;
102 typedef unsigned long long uint64_t;
104 #error Cannot find a 64-bit integer type 107 #error Cannot find a way to derive fixed-width integer types 111 #ifndef HAVE_INTPTR_T 114 #if defined(SIZEOF_VOID_P) && \ 115 defined(SIZEOF_SHORT) && \ 116 defined(SIZEOF_INT) && \ 117 defined(SIZEOF_LONG) && \ 118 defined(SIZEOF_LONG_LONG) 120 #if SIZEOF_VOID_P == SIZEOF_SHORT 121 typedef short intptr_t;
122 #define HAVE_INTPTR_T 123 #elif SIZEOF_VOID_P = SIZEOF_INT 124 typedef int intptr_t;
125 #define HAVE_INTPTR_T 126 #elif SIZEOF_VOID_P = SIZEOF_LONG 127 typedef long intptr_t;
128 #define HAVE_INTPTR_T 129 #elif SIZEOF_VOID_P = SIZEOF_LONG_LONG 130 typedef long long intptr_t;
131 #define HAVE_INTPTR_T 135 #ifndef HAVE_INTPTR_T 136 #error Cannot find a way to derive a signed integer type to fit a pointer 141 #ifndef HAVE_UINTPTR_T 144 #if defined(SIZEOF_VOID_P) && \ 145 defined(SIZEOF_SHORT) && \ 146 defined(SIZEOF_INT) && \ 147 defined(SIZEOF_LONG) && \ 148 defined(SIZEOF_LONG_LONG) 150 #if SIZEOF_VOID_P == SIZEOF_SHORT 151 typedef unsigned short uintptr_t;
152 #define HAVE_UINTPTR_T 153 #elif SIZEOF_VOID_P = SIZEOF_INT 154 typedef unsigned int uintptr_t;
155 #define HAVE_UINTPTR_T 156 #elif SIZEOF_VOID_P = SIZEOF_LONG 157 typedef unsigned long uintptr_t;
158 #define HAVE_UINTPTR_T 159 #elif SIZEOF_VOID_P = SIZEOF_LONG_LONG 160 typedef unsigned long long uintptr_t;
161 #define HAVE_UINTPTR_T 165 #ifndef HAVE_UINTPTR_T 166 #error Cannot find a way to derive an unsigned integer type to fit a pointer 172 #define SIZE_MAX ((size_t) -1) 178 #define Cd64(x) ((signed long long) (x)) 180 #define Cd64(x) ((int64) (x)) 186 #define Cu64(x) ((unsigned long long) (x)) 188 #define Cu64(x) ((uint64) (x)) 215 #define INT64_C(c) (c ## LL) 220 #define UINT64_C(c) (c ## ULL) 225 #define UINT8_MAX 0xFF 228 #define UINT16_MAX 0xFFFF 231 #define UINT32_MAX 0xFFFFFFFF 234 #define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) 238 #define INT8_MAX 0x7F 241 #define INT16_MAX 0x7FFF 244 #define INT32_MAX 0x7FFFFFFF 247 #define INT64_MAX INT64_C(0x7FFFFFFFFFFFFFFF) 251 #define INT8_MIN (-INT8_MAX - 1) 254 #define INT16_MIN (-INT16_MAX - 1) 257 #define INT32_MIN (-INT32_MAX - 1) 260 #define INT64_MIN (-INT64_MAX - INT64_C(1)) 263 #endif // COMMON_TYPES_H