1 /**
2  * @namespace   biewlib
3  * @file        biewlib/sysdep/ia16/stdint.h
4  * @brief       ISO C 9X: 7.18 Integer types <stdint.h>
5  * @version     7.18
6  * @remark      Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
7  *              This file is part of the GNU C Library.
8  *              The GNU C Library is free software; you can redistribute it and/or
9  *              modify it under the terms of the GNU Library General Public License as
10  *              published by the Free Software Foundation; either version 2 of the
11  *              License, or (at your option) any later version.
12  *              The GNU C Library is distributed in the hope that it will be useful,
13  *              but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *              Library General Public License for more details.
16  *              You should have received a copy of the GNU Library General Public
17  *              License along with the GNU C Library; see the file COPYING.LIB.  If not,
18  *              write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  *              Boston, MA 02111-1307, USA.
20  * @note        Requires POSIX compatible development system
21  *
22  * @author      GNU FSF
23  * @since       1997
24 **/
25 #ifndef _STDINT_H
26 #define _STDINT_H	1
27 
28 /** It is possible to compile containing GCC extensions even if GCC is
29     run in pedantic mode if the uses are carefully marked using the
30     `__extension__' keyword.  But this is not generally available before
31     version 2.8.  */
32 #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
33 # define __extension__		/**< Ignore */
34 #endif
35 
36 #define __WORDSIZE 16
37 
38 /** Exact integral types.  */
39 
40 /** Signed.  */
41 
42 /** There is some amount of overlap with <sys/types.h> as known by inet code */
43 typedef signed char		tInt8;
44 typedef signed short int	tInt16;
45 typedef signed long int		tInt32;
46 #ifdef __GNUC__
47 __extension__
48 typedef signed long long int	tInt64;
49 #else
50 # ifdef __WATCOMC__
51 typedef __int64			tInt64;
52 # endif
53 #endif
54 
55 /** Unsigned.  */
56 typedef unsigned char		tUInt8;
57 typedef unsigned short int	tUInt16;
58 typedef unsigned long int	tUInt32;
59 #ifdef __GNUC__
60 __extension__
61 typedef unsigned long long int	tUInt64;
62 #else
63 # ifdef __WATCOMC__
64 typedef unsigned __int64	tUInt64;
65 # endif
66 #endif
67 
68 
69 /** Small types.  */
70 
71 /** Signed.  */
72 typedef signed char		tIntLeast8;
73 typedef signed short int	tIntLeast16;
74 typedef signed long int		tIntLeast32;
75 #ifdef __GNUC__
76 __extension__
77 typedef signed long long int	tIntLeast64;
78 #else
79 # ifdef __WATCOMC__
80 typedef __int64			tIntLeast64;
81 # endif
82 #endif
83 
84 /** Unsigned.  */
85 typedef unsigned char		tUIntLeast8;
86 typedef unsigned short int	tUIntLeast16;
87 typedef unsigned long int	tUIntLeast32;
88 #ifdef __GNUC__
89 __extension__
90 typedef unsigned long long int	tUIntLeast64;
91 #else
92 # ifdef __WATCOMC__
93 typedef unsigned __int64	tUIntLeast64;
94 # endif
95 #endif
96 
97 
98 /** Fast types.  */
99 
100 /** Signed.  */
101 typedef signed char		tIntFast8;
102 typedef signed int		tIntFast16;
103 typedef signed long int		tIntFast32;
104 #ifdef __GNUC__
105 __extension__
106 typedef signed long long int	tIntFast64;
107 #else
108 # ifdef __WATCOMC__
109 typedef __int64			tIntFast64;
110 # endif
111 #endif
112 
113 /** Unsigned.  */
114 typedef unsigned char		tUIntFast8;
115 typedef unsigned int		tUIntFast16;
116 typedef unsigned long int	tUIntFast32;
117 #ifdef __GNUC__
118 __extension__
119 typedef unsigned long long int	tUIntFast64;
120 #else
121 # ifdef __WATCOMC__
122 typedef unsigned __int64	tUIntFast64;
123 # endif
124 #endif
125 
126 
127 /** Types for `void *' pointers.  */
128 #if defined( M_I86SM ) || defined( M_I86CM)
129 typedef signed int		tIntPtr;
130 #else
131 typedef long int		tIntPtr;
132 #endif
133 #if defined( M_I86SM ) || defined( M_I86CM)
134 typedef unsigned int		tUIntPtr;
135 #else
136 typedef unsigned long int	tUIntPtr;
137 #endif
138 
139 /** Largest integral types.  */
140 #ifdef __GNUC__
141 __extension__
142 typedef signed long long int	tIntMax;
143 __extension__
144 typedef unsigned long long int	tUIntMax;
145 #else
146 #ifdef __WATCOMC__
147 typedef __int64			tIntMax;
148 typedef unsigned __int64	tUIntMax;
149 #else
150 typedef signed long int		tIntMax;
151 typedef unsigned long int	tUIntMax;
152 #endif
153 #endif
154 
155 /** The ISO C 9X standard specifies that in C++ implementations these
156     macros should only be defined if explicitly requested.  */
157 #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
158 
159 #ifdef __GNUC__
160 #define __INT64_C(c)	c ## LL
161 #define __UINT64_C(c)	c ## ULL
162 #else /* Watcom C */
163 #define __INT64_C(c)	c ## i64
164 #define __UINT64_C(c)	c ## Ui64
165 #endif
166 
167 /** Limits of integral types.  */
168 
169 /** Minimum of signed integral types.  */
170 # define INT8_MIN		(-128)
171 # define INT16_MIN		(-32767-1)
172 # define INT32_MIN		(-2147483647L-1)
173 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
174 # define INT64_MIN		(-__INT64_C(9223372036854775807)-1)
175 #endif
176 /** Maximum of signed integral types.  */
177 # define INT8_MAX		(127)
178 # define INT16_MAX		(32767)
179 # define INT32_MAX		(2147483647L)
180 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
181 # define INT64_MAX		(__INT64_C(9223372036854775807))
182 #endif
183 
184 /** Maximum of unsigned integral types.  */
185 # define UINT8_MAX		(255U)
186 # define UINT16_MAX		(65535U)
187 # define UINT32_MAX		(4294967295UL)
188 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
189 # define UINT64_MAX		(__UINT64_C(18446744073709551615))
190 #endif
191 
192 /** Minimum of signed integral types having a minimum size.  */
193 # define INT_LEAST8_MIN		(-128)
194 # define INT_LEAST16_MIN	(-32767-1)
195 # define INT_LEAST32_MIN	(-2147483647L-1)
196 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
197 # define INT_LEAST64_MIN	(-__INT64_C(9223372036854775807)-1)
198 #endif
199 /** Maximum of signed integral types having a minimum size.  */
200 # define INT_LEAST8_MAX		(127)
201 # define INT_LEAST16_MAX	(32767)
202 # define INT_LEAST32_MAX	(2147483647L)
203 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
204 # define INT_LEAST64_MAX	(__INT64_C(9223372036854775807))
205 #endif
206 
207 /** Maximum of unsigned integral types having a minimum size.  */
208 # define UINT_LEAST8_MAX	(255U)
209 # define UINT_LEAST16_MAX	(65535U)
210 # define UINT_LEAST32_MAX	(4294967295UL)
211 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
212 # define UINT_LEAST64_MAX	(__UINT64_C(18446744073709551615))
213 #endif
214 
215 /** Minimum of fast signed integral types having a minimum size.  */
216 # define INT_FAST8_MIN		(-128)
217 # define INT_FAST16_MIN		(-32767-1)
218 # define INT_FAST32_MIN		(-2147483647L-1)
219 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
220 # define INT_FAST64_MIN		(-__INT64_C(9223372036854775807)-1)
221 #endif
222 /** Maximum of fast signed integral types having a minimum size.  */
223 # define INT_FAST8_MAX		(127)
224 # define INT_FAST16_MAX		(32767)
225 # define INT_FAST32_MAX		(2147483647L)
226 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
227 # define INT_FAST64_MAX		(__INT64_C(9223372036854775807))
228 #endif
229 
230 /** Maximum of fast unsigned integral types having a minimum size.  */
231 # define UINT_FAST8_MAX		(255U)
232 # define UINT_FAST16_MAX	(65535U)
233 # define UINT_FAST32_MAX	(4294967295UL)
234 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
235 # define UINT_FAST64_MAX	(__UINT64_C(18446744073709551615))
236 #endif
237 
238 
239 /** Values to test for integral types holding `void *' pointer.  */
240 # define INTPTR_MIN		(-2147483647L-1)
241 # define INTPTR_MAX		(2147483647L)
242 # define UINTPTR_MAX		(4294967295UL)
243 
244 
245 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
246 /* Minimum for largest signed integral type.  */
247 # define INTMAX_MIN		(-__INT64_C(9223372036854775807)-1)
248 /** Maximum for largest signed integral type.  */
249 # define INTMAX_MAX		(__INT64_C(9223372036854775807))
250 /** Maximum for largest unsigned integral type.  */
251 # define UINTMAX_MAX		(__UINT64_C(18446744073709551615))
252 #else
253 /** Minimum for largest signed integral type.  */
254 # define INTMAX_MIN		(-2147483647L-1)
255 /** Maximum for largest signed integral type.  */
256 # define INTMAX_MAX		(2147483647L)
257 /** Maximum for largest unsigned integral type.  */
258 # define UINTMAX_MAX		(4294967295UL)
259 #endif
260 
261 /** Limits of other integer types.  */
262 #if defined(M_I86SM) || defined(M_I86CM)
263 /** Limits of `ptrdiff_t' type.  */
264 # define PTRDIFF_MIN		(-32767-1)
265 # define PTRDIFF_MAX		(32767)
266 
267 /** Limits of `sig_atomic_t'.  */
268 # define SIG_ATOMIC_MIN		(-32767-1)
269 # define SIG_ATOMIC_MAX		(32767)
270 #else
271 /** Limits of `ptrdiff_t' type.  */
272 # define PTRDIFF_MIN		(-2147483647L-1)
273 # define PTRDIFF_MAX		(2147483647L)
274 
275 /** Limits of `sig_atomic_t'.  */
276 # define SIG_ATOMIC_MIN		(-2147483647L-1)
277 # define SIG_ATOMIC_MAX		(2147483647L)
278 #endif
279 /** Limit of `size_t' type.  */
280 # define SIZE_MAX		(65535U)
281 
282 /** Limits of `wchar_t'.  */
283 # ifndef WCHAR_MIN
284 /** These constants might also be defined in <wchar.h>.  */
285 #  define WCHAR_MIN		(-32767-1)
286 #  define WCHAR_MAX		(32767)
287 # endif
288 
289 /** Limits of `wint_t'.  */
290 #ifndef WINT_MIN
291 # define WINT_MIN		(0)
292 # define WINT_MAX		(65535U)
293 #endif
294 #endif	/** C++ && limit macros */
295 
296 
297 /** The ISO C 9X standard specifies that in C++ implementations these
298    should only be defined if explicitly requested.  */
299 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
300 
301 /** Signed.  */
302 # define INT8_C(c)	c
303 # define INT16_C(c)	c
304 # define INT32_C(c)	c ## L
305 #ifdef __GNUC__
306 # define INT64_C(c)	c ## LL
307 #else
308 #ifdef __WATCOMC__
309 # define INT64_C(c)	c ## i64
310 #endif
311 #endif
312 
313 /** Unsigned.  */
314 # define UINT8_C(c)	c ## U
315 # define UINT16_C(c)	c ## U
316 # define UINT32_C(c)	c ## UL
317 #ifdef __GNUC__
318 # define UINT64_C(c)	c ## ULL
319 /** Maximal type.  */
320 # define INTMAX_C(c)	c ## LL
321 # define UINTMAX_C(c)	c ## ULL
322 #else
323 #ifdef __WATCOMC__
324 # define UINT64_C(c)	c ## Ui64
325 /** Maximal type.  */
326 # define INTMAX_C(c)	c ## i64
327 # define UINTMAX_C(c)	c ## Ui64
328 #endif
329 #endif
330 
331 #endif	/** C++ && constant macros */
332 
333 #endif /* stdint.h */
334