1 #ifndef EL__OSDEP_TYPES_H
2 #define EL__OSDEP_TYPES_H
8 #ifdef HAVE_SYS_TYPES_H
20 #ifdef HAVE_INTTYPES_H
25 #define SHRT_MAX 0x7fff
29 #define USHRT_MAX 0xffff
34 #define INT_MAX MAXINT
36 #define INT_MAX 0x7fffffff
42 #define UINT_MAX MAXUINT
44 #define UINT_MAX 0xffffffff
50 #define LONG_MAX MAXLONG
52 #define LONG_MAX 0x7fffffff
56 #if defined(HAVE_LONG_LONG) && !defined(LLONG_MAX)
58 #define LLONG_MAX MAXLLONG
59 #elif SIZEOF_LONG_LONG == 8
60 #define LLONG_MAX 9223372036854775807LL
61 #elif SIZEOF_LONG_LONG == 4
62 #define LLONG_MAX LONG_MAX
67 #if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T == SIZEOF_LONG_LONG
68 #define OFFT_MAX LLONG_MAX
69 #elif SIZEOF_OFF_T == SIZEOF_LONG
70 #define OFFT_MAX LONG_MAX
71 #elif SIZEOF_OFF_T == SIZEOF_INT
72 #define OFFT_MAX INT_MAX
73 #elif SIZEOF_OFF_T == SIZEOF_SHORT
74 #define OFFT_MAX SHRT_MAX
80 typedef unsigned char uint16_t;
81 #elif SIZEOF_SHORT == 2
82 typedef unsigned short uint16_t;
84 typedef unsigned int uint16_t;
85 #elif SIZEOF_LONG == 2
86 typedef unsigned long uint16_t;
87 #elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 2
88 typedef unsigned long long uint16_t;
90 #error You have no 16-bit integer type. Get in touch with reality.
97 #elif SIZEOF_SHORT == 4
98 typedef short int32_t;
101 #elif SIZEOF_LONG == 4
102 typedef long int32_t;
103 #elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 4
104 typedef long long int32_t;
106 #error You have no 32-bit integer type. Get in touch with reality.
110 #ifndef HAVE_UINT32_T
112 typedef unsigned char uint32_t;
113 #elif SIZEOF_SHORT == 4
114 typedef unsigned short uint32_t;
115 #elif SIZEOF_INT == 4
116 typedef unsigned int uint32_t;
117 #elif SIZEOF_LONG == 4
118 typedef unsigned long uint32_t;
119 #elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 4
120 typedef unsigned long long uint32_t;
122 #error You have no 32-bit integer type. Get in touch with reality.
126 #ifdef HAVE_LONG_LONG
127 #define longlong long long
129 #define longlong long
132 /* These are mostly for shutting up sparse warnings. */
134 #define __INT_MAX__ 0x7fffffff
137 #define __LONG_MAX__ 0x7fffffff
140 #define __SHRT_MAX__ 0x7fff
144 * long l; (long) (longptr_T) l == l
145 * void *p; (void *) (longptr_T) p == p
147 typedef long longptr_T
;
149 /* To print off_t offset, ELinks does:
151 * printf("%" OFF_PRINT_FORMAT, (off_print_T) offset);
153 * The cast is necessary because it is not possible to guess
154 * a printf format for off_t itself based on what we have here.
155 * The off_t type might be either long or long long, and the format
156 * string must match even if both types have the same representation,
157 * because GCC warns about mismatches and --enable-debug adds -Werror
159 #if !HAVE_OFF_T || SIZEOF_OFF_T <= SIZEOF_LONG
160 typedef long off_print_T
;
161 # define OFF_PRINT_FORMAT "ld"
162 #elif HAVE_LONG_LONG && SIZEOF_OFF_T <= SIZEOF_LONG_LONG
163 typedef long long off_print_T
;
164 # define OFF_PRINT_FORMAT "lld"
166 # error "cannot figure out how to print off_t values"