Go to the documentation of this file.
21 #ifdef HAVE_SYS_TYPES_H
22 #include <sys/types.h>
24 #ifdef HAVE_SYS_LIMITS_H
25 #include <sys/limits.h>
29 #if SIZEOF_SIZE_T == 8
30 #define SIZE_MAX UINT64_MAX
31 #elif SIZEOF_SIZE_T == 4
32 #define SIZE_MAX UINT32_MAX
34 #error "Can't define SIZE_MAX"
39 #if SIZEOF_SIZE_T == 8
40 typedef int64_t ssize_t;
41 #elif SIZEOF_SIZE_T == 4
42 typedef int32_t ssize_t;
44 #error "Can't define ssize_t."
51 #ifndef USING_TWOS_COMPLEMENT
52 #error "Your platform doesn't use 2's complement arithmetic."
57 #if (SIZEOF_TIME_T == SIZEOF_INT)
58 #define TIME_MAX ((time_t)INT_MAX)
59 #elif (SIZEOF_TIME_T == SIZEOF_LONG)
60 #define TIME_MAX ((time_t)LONG_MAX)
61 #elif (SIZEOF_TIME_T == 8)
62 #define TIME_MAX ((time_t)INT64_MAX)
64 #error "Can't define TIME_MAX"
71 #if (SIZEOF_TIME_T == SIZEOF_INT)
72 #define TIME_MIN ((time_t)INT_MIN)
73 #elif (SIZEOF_TIME_T == SIZEOF_LONG)
74 #define TIME_MIN ((time_t)LONG_MIN)
75 #elif (SIZEOF_TIME_T == 8)
76 #define TIME_MIN ((time_t)INT64_MIN)
78 #error "Can't define TIME_MIN"
84 #if (SIZEOF_SIZE_T == 4)
85 #define SIZE_MAX UINT32_MAX
86 #elif (SIZEOF_SIZE_T == 8)
87 #define SIZE_MAX UINT64_MAX
89 #error "Can't define SIZE_MAX"
95 # define TOR_PRIuSZ PRIu64
97 # define TOR_PRIuSZ PRIu32
100 # define TOR_PRIuSZ "zu"
105 # define TOR_PRIdSZ PRId64
107 # define TOR_PRIdSZ PRId32
110 # define TOR_PRIdSZ "zd"
114 #if (SIZEOF_SIZE_T == 4)
115 #define SSIZE_MAX INT32_MAX
116 #elif (SIZEOF_SIZE_T == 8)
117 #define SSIZE_MAX INT64_MAX
119 #error "Can't define SSIZE_MAX"
124 #define SSIZE_T_CEILING ((ssize_t)(SSIZE_MAX-16))
126 #define SIZE_T_CEILING ((size_t)(SSIZE_MAX-16))
128 #if SIZEOF_INT > SIZEOF_VOID_P
129 #error "sizeof(int) > sizeof(void *) - Can't build Tor here."
132 #if SIZEOF_UNSIGNED_INT > SIZEOF_VOID_P
133 #error "sizeof(unsigned int) > sizeof(void *) - Can't build Tor here."