Added lance entry to drivers.conf.
[minix3-old.git] / include / stdint.h
blob7eb0afd2e3f0c4cff7bccbef88c82702f9a216be
1 /* stdint.h - Standard sized integer types. Author: Kees J. Bot
2 * 4 Oct 2003
4 * Assumption: Long is the biggest type.
5 * Bug: C99 requires a 64 bit type, and long isn't 64 bits yet, and
6 * will never be 64 bits under 16-bits Minix.
7 * Omission: Limits like PTR_DIFF_MAX not here yet, maybe <limits.h>?
8 */
10 #ifndef _STDINT_H
11 #define _STDINT_H
13 #ifndef _MINIX__TYPES_H
14 #include <sys/types.h>
15 #endif
16 #include <minix/sys_config.h>
18 #if (_WORD_SIZE != 2 && _WORD_SIZE != 4) || \
19 (_PTR_SIZE != _WORD_SIZE && _PTR_SIZE != 2*_WORD_SIZE)
20 #error Odd word or pointer sizes
21 #endif
23 /* Integer types of precisely the given bitsize. */
24 typedef i8_t int8_t;
25 typedef i16_t int16_t;
26 typedef i32_t int32_t;
27 #if _WORD_SIZE > 2 && __L64
28 typedef i64_t int64_t;
29 #endif
31 typedef u8_t uint8_t;
32 typedef u16_t uint16_t;
33 typedef u32_t uint32_t;
34 #if _WORD_SIZE > 2 && __L64
35 typedef u64_t uint64_t;
36 #endif
38 /* Integer types of at least the given bitsize. */
39 typedef int8_t int_least8_t;
40 typedef int16_t int_least16_t;
41 typedef int32_t int_least32_t;
42 #if _WORD_SIZE > 2 && __L64
43 typedef int64_t int_least64_t;
44 #endif
46 typedef uint8_t uint_least8_t;
47 typedef uint16_t uint_least16_t;
48 typedef uint32_t uint_least32_t;
49 #if _WORD_SIZE > 2 && __L64
50 typedef uint64_t uint_least64_t;
51 #endif
53 /* Fast integer types of at least the given bitsize. */
54 #if _WORD_SIZE == 2
55 typedef int16_t int_fast8_t;
56 typedef int16_t int_fast16_t;
57 #else
58 typedef int32_t int_fast8_t;
59 typedef int32_t int_fast16_t;
60 #endif
61 typedef int32_t int_fast32_t;
62 #if _WORD_SIZE > 2 && __L64
63 typedef int64_t int_fast64_t;
64 #endif
66 #if _WORD_SIZE == 2
67 typedef uint16_t uint_fast8_t;
68 typedef uint16_t uint_fast16_t;
69 #else
70 typedef uint32_t uint_fast8_t;
71 typedef uint32_t uint_fast16_t;
72 #endif
73 typedef uint32_t uint_fast32_t;
74 #if _WORD_SIZE > 2 && __L64
75 typedef uint64_t uint_fast64_t;
76 #endif
78 /* Integer type capable of holding a pointer and the largest integer type. */
79 #if _PTR_SIZE == _WORD_SIZE
80 typedef int intptr_t;
81 typedef unsigned uintptr_t;
82 #elif _PTR_SIZE == 2*_WORD_SIZE
83 typedef long intptr_t;
84 typedef unsigned long uintptr_t;
85 #endif
86 typedef long intmax_t;
87 typedef unsigned long uintmax_t;
89 #if !__cplusplus || defined(__STDC_LIMIT_MACROS)
90 #ifndef _LIMITS_H
91 #include <limits.h>
92 #endif
94 /* Range definitions for each of the above types conform <limits.h>. */
95 #define INT8_MIN (-INT8_MAX-1)
96 #define INT16_MIN (-INT16_MAX-1)
97 #define INT32_MIN (-INT32_MAX-1)
98 #if _WORD_SIZE > 2 && __L64
99 #define INT64_MIN (-INT64_MAX-1)
100 #endif
102 #define INT8_MAX 127
103 #define INT16_MAX 32767
104 #define INT32_MAX 2147483647
105 #if _WORD_SIZE > 2 && __L64
106 #define INT64_MAX 9223372036854775807
107 #endif
109 #define UINT8_MAX 255
110 #define UINT16_MAX 65535
111 #define UINT32_MAX 4294967295
112 #if _WORD_SIZE > 2 && __L64
113 #define UINT64_MAX 18446744073709551615
114 #endif
116 #define INT_LEAST8_MIN INT8_MIN
117 #define INT_LEAST16_MIN INT16_MIN
118 #define INT_LEAST32_MIN INT32_MIN
119 #if _WORD_SIZE > 2 && __L64
120 #define INT_LEAST64_MIN INT64_MIN
121 #endif
123 #define INT_LEAST8_MAX INT8_MAX
124 #define INT_LEAST16_MAX INT16_MAX
125 #define INT_LEAST32_MAX INT32_MAX
126 #if _WORD_SIZE > 2 && __L64
127 #define INT_LEAST64_MAX INT64_MAX
128 #endif
130 #define UINT_LEAST8_MAX UINT8_MAX
131 #define UINT_LEAST16_MAX UINT16_MAX
132 #define UINT_LEAST32_MAX UINT32_MAX
133 #if _WORD_SIZE > 2 && __L64
134 #define UINT_LEAST64_MAX UINT64_MAX
135 #endif
137 #define INT_FAST8_MIN (-INT_FAST8_MAX-1)
138 #define INT_FAST16_MIN (-INT_FAST16_MAX-1)
139 #define INT_FAST32_MIN INT32_MIN
140 #if _WORD_SIZE > 2 && __L64
141 #define INT_FAST64_MIN INT64_MIN
142 #endif
144 #if _WORD_SIZE == 2
145 #define INT_FAST8_MAX INT16_MAX
146 #define INT_FAST16_MAX INT16_MAX
147 #else
148 #define INT_FAST8_MAX INT32_MAX
149 #define INT_FAST16_MAX INT32_MAX
150 #endif
151 #define INT_FAST32_MAX INT32_MAX
152 #if _WORD_SIZE > 2 && __L64
153 #define INT_FAST64_MAX INT64_MAX
154 #endif
156 #if _WORD_SIZE == 2
157 #define UINT_FAST8_MAX UINT16_MAX
158 #define UINT_FAST16_MAX UINT16_MAX
159 #else
160 #define UINT_FAST8_MAX UINT32_MAX
161 #define UINT_FAST16_MAX UINT32_MAX
162 #endif
163 #define UINT_FAST32_MAX UINT32_MAX
164 #if _WORD_SIZE > 2 && __L64
165 #define UINT_FAST64_MAX UINT64_MAX
166 #endif
168 #if _PTR_SIZE == _WORD_SIZE
169 #define INTPTR_MIN INT_MIN
170 #define INTPTR_MAX INT_MAX
171 #define UINTPTR_MAX UINT_MAX
172 #elif _PTR_SIZE > _WORD_SIZE
173 #define INTPTR_MIN LONG_MIN
174 #define INTPTR_MAX LONG_MAX
175 #define UINTPTR_MAX ULONG_MAX
176 #endif
177 #define INTMAX_MIN LONG_MIN
178 #define INTMAX_MAX LONG_MAX
179 #define UINTMAX_MAX ULONG_MAX
181 #endif /* !__cplusplus || __STDC_LIMIT_MACROS */
183 #ifndef __CONCAT
184 #define __CONCAT(x,y) x ## y
185 #endif
187 /* Constants of the proper type. */
188 #define INT8_C(c) c
189 #define INT16_C(c) c
190 #if _WORD_SIZE == 2
191 #define INT32_C(c) __CONCAT(c,l)
192 #else
193 #define INT32_C(c) c
194 #endif
195 #if _WORD_SIZE > 2 && __L64
196 #define INT64_C(c) __CONCAT(c,l)
197 #endif
199 #define UINT8_C(c) __CONCAT(c,u)
200 #define UINT16_C(c) __CONCAT(c,u)
201 #if _WORD_SIZE == 2
202 #define UINT32_C(c) __CONCAT(c,lu)
203 #else
204 #define UINT32_C(c) __CONCAT(c,u)
205 #endif
206 #if _WORD_SIZE > 2 && __L64
207 #define UINT64_C(c) __CONCAT(c,lu)
208 #endif
210 #if _WORD_SIZE == 2 || !__L64
211 #define INTMAX_C(c) INT32_C(c)
212 #define UINTMAX_C(c) UINT32_C(c)
213 #else
214 #define INTMAX_C(c) INT64_C(c)
215 #define UINTMAX_C(c) UINT64_C(c)
216 #endif
218 #endif /* _STDINT_H */
221 * $PchId: stdint.h,v 1.2 2005/01/27 17:32:00 philip Exp $