Go to the documentation of this file. 19 #ifdef HAVE_SYS_TYPES_H 20 #include <sys/types.h> 25 #ifdef HAVE_SYS_LIMITS_H 26 #include <sys/limits.h> 28 #ifdef HAVE_MACHINE_LIMITS_H 29 #if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) 36 #include <machine/limits.h> 39 #ifdef HAVE_INTTYPES_H 45 #if (SIZEOF_INT8_T != 0) 48 #if (SIZEOF_INT16_T != 0) 51 #if (SIZEOF_INT32_T != 0) 54 #if (SIZEOF_INT64_T != 0) 57 #if (SIZEOF_UINT8_T != 0) 60 #if (SIZEOF_UINT16_T != 0) 63 #if (SIZEOF_UINT32_T != 0) 66 #if (SIZEOF_UINT64_T != 0) 69 #if (SIZEOF_INTPTR_T != 0) 72 #if (SIZEOF_UINTPTR_T != 0) 73 #define HAVE_UINTPTR_T 76 #if (SIZEOF_CHAR == 1) 78 typedef signed char int8_t;
82 typedef unsigned char uint8_t;
87 #if (SIZEOF_SHORT == 2) 89 typedef signed short int16_t;
93 typedef unsigned short uint16_t;
100 typedef signed int int16_t;
103 #ifndef HAVE_UINT16_T 104 typedef unsigned int uint16_t;
105 #define HAVE_UINT16_T 107 #elif (SIZEOF_INT == 4) 109 typedef signed int int32_t;
112 #ifndef HAVE_UINT32_T 113 typedef unsigned int uint32_t;
114 #define HAVE_UINT32_T 117 #define UINT16_MAX 0xffffu 120 #define INT16_MAX 0x7fff 123 #define INT16_MIN (-INT16_MAX-1) 126 #define UINT32_MAX 0xffffffffu 129 #define INT32_MAX 0x7fffffff 132 #define INT32_MIN (-2147483647-1) 136 #if (SIZEOF_LONG == 4) 138 typedef signed long int32_t;
141 #ifndef HAVE_UINT32_T 142 typedef unsigned long uint32_t;
143 #define HAVE_UINT32_T 145 #define UINT32_MAX 0xfffffffful 148 #elif (SIZEOF_LONG == 8) 150 typedef signed long int64_t;
153 #ifndef HAVE_UINT32_T 154 typedef unsigned long uint64_t;
155 #define HAVE_UINT32_T 158 #define UINT64_MAX 0xfffffffffffffffful 162 #if (SIZEOF_LONG_LONG == 8) 164 typedef signed long long int64_t;
167 #ifndef HAVE_UINT64_T 168 typedef unsigned long long uint64_t;
169 #define HAVE_UINT64_T 172 #define UINT64_MAX 0xffffffffffffffffull 175 #define INT64_MAX 0x7fffffffffffffffll 179 #if (SIZEOF___INT64 == 8) 181 typedef signed __int64 int64_t;
184 #ifndef HAVE_UINT64_T 185 typedef unsigned __int64 uint64_t;
186 #define HAVE_UINT64_T 189 #define UINT64_MAX 0xffffffffffffffffui64 192 #define INT64_MAX 0x7fffffffffffffffi64 197 #define INT64_MIN ((- INT64_MAX) - 1) 201 #if SIZEOF_SIZE_T == 8 202 #define SIZE_MAX UINT64_MAX 203 #elif SIZEOF_SIZE_T == 4 204 #define SIZE_MAX UINT32_MAX 206 #error "Can't define SIZE_MAX" 211 #if SIZEOF_SIZE_T == 8 212 typedef int64_t ssize_t;
213 #elif SIZEOF_SIZE_T == 4 214 typedef int32_t ssize_t;
216 #error "Can't define ssize_t." 220 #if (SIZEOF_VOID_P > 4 && SIZEOF_VOID_P <= 8) 221 #ifndef HAVE_INTPTR_T 222 typedef int64_t intptr_t;
223 #define SIZEOF_INTPTR_T 8 225 #ifndef HAVE_UINTPTR_T 226 typedef uint64_t uintptr_t;
227 #define SIZEOF_UINTPTR_T 8 229 #elif (SIZEOF_VOID_P > 2 && SIZEOF_VOID_P <= 4) 230 #ifndef HAVE_INTPTR_T 231 typedef int32_t intptr_t;
232 #define SIZEOF_INTPTR_T 4 234 #ifndef HAVE_UINTPTR_T 235 typedef uint32_t uintptr_t;
236 #define SIZEOF_UINTPTR_T 4 239 #error "void * is either >8 bytes or <= 2. In either case, I am confused." 243 #error "Missing type int8_t" 246 #error "Missing type uint8_t" 249 #error "Missing type int16_t" 251 #ifndef HAVE_UINT16_T 252 #error "Missing type uint16_t" 255 #error "Missing type int32_t" 257 #ifndef HAVE_UINT32_T 258 #error "Missing type uint32_t" 261 #error "Missing type int64_t" 263 #ifndef HAVE_UINT64_T 264 #error "Missing type uint64_t" 270 #ifndef USING_TWOS_COMPLEMENT 271 #error "Seems that your platform doesn't use 2's complement arithmetic. Argh." 274 #if (SIZEOF_LONG == 4) 275 #define LONG_MAX 0x7fffffffL 276 #elif (SIZEOF_LONG == 8) 277 #define LONG_MAX 0x7fffffffffffffffL 279 #error "Can't define LONG_MAX" 284 #if (SIZEOF_INT == 4) 285 #define INT_MAX 0x7fffffffL 286 #elif (SIZEOF_INT == 8) 287 #define INT_MAX 0x7fffffffffffffffL 289 #error "Can't define INT_MAX" 294 #if (SIZEOF_INT == 2) 295 #define UINT_MAX 0xffffu 296 #elif (SIZEOF_INT == 4) 297 #define UINT_MAX 0xffffffffu 298 #elif (SIZEOF_INT == 8) 299 #define UINT_MAX 0xffffffffffffffffu 301 #error "Can't define UINT_MAX" 306 #if (SIZEOF_SHORT == 2) 307 #define SHORT_MAX 0x7fff 308 #elif (SIZEOF_SHORT == 4) 309 #define SHORT_MAX 0x7fffffff 311 #error "Can't define SHORT_MAX" 317 #if (SIZEOF_TIME_T == SIZEOF_INT) 318 #define TIME_MAX ((time_t)INT_MAX) 319 #elif (SIZEOF_TIME_T == SIZEOF_LONG) 320 #define TIME_MAX ((time_t)LONG_MAX) 321 #elif (SIZEOF_TIME_T == 8) 322 #define TIME_MAX ((time_t)INT64_MAX) 324 #error "Can't define TIME_MAX" 331 #if (SIZEOF_TIME_T == SIZEOF_INT) 332 #define TIME_MIN ((time_t)INT_MIN) 333 #elif (SIZEOF_TIME_T == SIZEOF_LONG) 334 #define TIME_MIN ((time_t)LONG_MIN) 335 #elif (SIZEOF_TIME_T == 8) 336 #define TIME_MIN ((time_t)INT64_MIN) 338 #error "Can't define TIME_MIN" 344 #if (SIZEOF_SIZE_T == 4) 345 #define SIZE_MAX UINT32_MAX 346 #elif (SIZEOF_SIZE_T == 8) 347 #define SIZE_MAX UINT64_MAX 349 #error "Can't define SIZE_MAX" 355 # define TOR_PRIuSZ PRIu64 357 # define TOR_PRIuSZ PRIu32 360 # define TOR_PRIuSZ "zu" 364 #if (SIZEOF_SIZE_T == 4) 365 #define SSIZE_MAX INT32_MAX 366 #elif (SIZEOF_SIZE_T == 8) 367 #define SSIZE_MAX INT64_MAX 369 #error "Can't define SSIZE_MAX" 374 #define SSIZE_T_CEILING ((ssize_t)(SSIZE_MAX-16)) 376 #define SIZE_T_CEILING ((size_t)(SSIZE_MAX-16))