]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/generic/stdint.h
Fix tst-support_record_failure-2 for run-built-tests = no.
[thirdparty/glibc.git] / sysdeps / generic / stdint.h
CommitLineData
f7a9f785 1/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
1c25bcac
UD
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
1c25bcac
UD
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
1c25bcac 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
1c25bcac
UD
17
18/*
63ae7b63 19 * ISO C99: 7.18 Integer types <stdint.h>
1c25bcac
UD
20 */
21
22#ifndef _STDINT_H
23#define _STDINT_H 1
24
5b17fd0d
JM
25#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
26#include <bits/libc-header-start.h>
417bafec 27#include <bits/wchar.h>
1c25bcac
UD
28#include <bits/wordsize.h>
29
30/* Exact integral types. */
31
32/* Signed. */
33
34/* There is some amount of overlap with <sys/types.h> as known by inet code */
35#ifndef __int8_t_defined
36# define __int8_t_defined
37typedef signed char int8_t;
38typedef short int int16_t;
39typedef int int32_t;
40# if __WORDSIZE == 64
41typedef long int int64_t;
42# else
43__extension__
44typedef long long int int64_t;
45# endif
46#endif
47
48/* Unsigned. */
49typedef unsigned char uint8_t;
50typedef unsigned short int uint16_t;
9b48fa9b 51#ifndef __uint32_t_defined
1c25bcac 52typedef unsigned int uint32_t;
9b48fa9b
UD
53# define __uint32_t_defined
54#endif
1c25bcac
UD
55#if __WORDSIZE == 64
56typedef unsigned long int uint64_t;
57#else
58__extension__
59typedef unsigned long long int uint64_t;
60#endif
61
62
63/* Small types. */
64
65/* Signed. */
66typedef signed char int_least8_t;
67typedef short int int_least16_t;
68typedef int int_least32_t;
69#if __WORDSIZE == 64
70typedef long int int_least64_t;
71#else
72__extension__
73typedef long long int int_least64_t;
74#endif
75
76/* Unsigned. */
77typedef unsigned char uint_least8_t;
78typedef unsigned short int uint_least16_t;
79typedef unsigned int uint_least32_t;
80#if __WORDSIZE == 64
81typedef unsigned long int uint_least64_t;
82#else
83__extension__
84typedef unsigned long long int uint_least64_t;
85#endif
86
87
88/* Fast types. */
89
90/* Signed. */
91typedef signed char int_fast8_t;
92#if __WORDSIZE == 64
93typedef long int int_fast16_t;
94typedef long int int_fast32_t;
95typedef long int int_fast64_t;
96#else
97typedef int int_fast16_t;
98typedef int int_fast32_t;
99__extension__
100typedef long long int int_fast64_t;
101#endif
102
103/* Unsigned. */
104typedef unsigned char uint_fast8_t;
105#if __WORDSIZE == 64
106typedef unsigned long int uint_fast16_t;
107typedef unsigned long int uint_fast32_t;
108typedef unsigned long int uint_fast64_t;
109#else
110typedef unsigned int uint_fast16_t;
111typedef unsigned int uint_fast32_t;
112__extension__
113typedef unsigned long long int uint_fast64_t;
114#endif
115
116
117/* Types for `void *' pointers. */
118#if __WORDSIZE == 64
7df789e0 119# ifndef __intptr_t_defined
1c25bcac 120typedef long int intptr_t;
7df789e0 121# define __intptr_t_defined
1c25bcac
UD
122# endif
123typedef unsigned long int uintptr_t;
124#else
7df789e0 125# ifndef __intptr_t_defined
1c25bcac 126typedef int intptr_t;
7df789e0 127# define __intptr_t_defined
1c25bcac
UD
128# endif
129typedef unsigned int uintptr_t;
130#endif
131
132
133/* Largest integral types. */
134#if __WORDSIZE == 64
135typedef long int intmax_t;
136typedef unsigned long int uintmax_t;
137#else
138__extension__
139typedef long long int intmax_t;
140__extension__
141typedef unsigned long long int uintmax_t;
142#endif
143
144
1c25bcac
UD
145# if __WORDSIZE == 64
146# define __INT64_C(c) c ## L
147# define __UINT64_C(c) c ## UL
148# else
149# define __INT64_C(c) c ## LL
150# define __UINT64_C(c) c ## ULL
151# endif
152
153/* Limits of integral types. */
154
155/* Minimum of signed integral types. */
156# define INT8_MIN (-128)
157# define INT16_MIN (-32767-1)
158# define INT32_MIN (-2147483647-1)
159# define INT64_MIN (-__INT64_C(9223372036854775807)-1)
160/* Maximum of signed integral types. */
161# define INT8_MAX (127)
162# define INT16_MAX (32767)
163# define INT32_MAX (2147483647)
164# define INT64_MAX (__INT64_C(9223372036854775807))
165
166/* Maximum of unsigned integral types. */
417bafec
UD
167# define UINT8_MAX (255)
168# define UINT16_MAX (65535)
1c25bcac
UD
169# define UINT32_MAX (4294967295U)
170# define UINT64_MAX (__UINT64_C(18446744073709551615))
171
172
173/* Minimum of signed integral types having a minimum size. */
174# define INT_LEAST8_MIN (-128)
175# define INT_LEAST16_MIN (-32767-1)
176# define INT_LEAST32_MIN (-2147483647-1)
177# define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1)
178/* Maximum of signed integral types having a minimum size. */
179# define INT_LEAST8_MAX (127)
180# define INT_LEAST16_MAX (32767)
181# define INT_LEAST32_MAX (2147483647)
182# define INT_LEAST64_MAX (__INT64_C(9223372036854775807))
183
184/* Maximum of unsigned integral types having a minimum size. */
417bafec
UD
185# define UINT_LEAST8_MAX (255)
186# define UINT_LEAST16_MAX (65535)
1c25bcac
UD
187# define UINT_LEAST32_MAX (4294967295U)
188# define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615))
189
190
191/* Minimum of fast signed integral types having a minimum size. */
192# define INT_FAST8_MIN (-128)
193# if __WORDSIZE == 64
194# define INT_FAST16_MIN (-9223372036854775807L-1)
195# define INT_FAST32_MIN (-9223372036854775807L-1)
196# else
197# define INT_FAST16_MIN (-2147483647-1)
198# define INT_FAST32_MIN (-2147483647-1)
199# endif
200# define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1)
201/* Maximum of fast signed integral types having a minimum size. */
202# define INT_FAST8_MAX (127)
203# if __WORDSIZE == 64
204# define INT_FAST16_MAX (9223372036854775807L)
205# define INT_FAST32_MAX (9223372036854775807L)
206# else
207# define INT_FAST16_MAX (2147483647)
208# define INT_FAST32_MAX (2147483647)
209# endif
210# define INT_FAST64_MAX (__INT64_C(9223372036854775807))
211
212/* Maximum of fast unsigned integral types having a minimum size. */
417bafec 213# define UINT_FAST8_MAX (255)
1c25bcac
UD
214# if __WORDSIZE == 64
215# define UINT_FAST16_MAX (18446744073709551615UL)
216# define UINT_FAST32_MAX (18446744073709551615UL)
217# else
218# define UINT_FAST16_MAX (4294967295U)
219# define UINT_FAST32_MAX (4294967295U)
220# endif
221# define UINT_FAST64_MAX (__UINT64_C(18446744073709551615))
222
223
224/* Values to test for integral types holding `void *' pointer. */
225# if __WORDSIZE == 64
226# define INTPTR_MIN (-9223372036854775807L-1)
227# define INTPTR_MAX (9223372036854775807L)
228# define UINTPTR_MAX (18446744073709551615UL)
229# else
230# define INTPTR_MIN (-2147483647-1)
231# define INTPTR_MAX (2147483647)
232# define UINTPTR_MAX (4294967295U)
233# endif
234
235
236/* Minimum for largest signed integral type. */
237# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
238/* Maximum for largest signed integral type. */
239# define INTMAX_MAX (__INT64_C(9223372036854775807))
240
241/* Maximum for largest unsigned integral type. */
242# define UINTMAX_MAX (__UINT64_C(18446744073709551615))
243
244
245/* Limits of other integer types. */
246
247/* Limits of `ptrdiff_t' type. */
248# if __WORDSIZE == 64
249# define PTRDIFF_MIN (-9223372036854775807L-1)
250# define PTRDIFF_MAX (9223372036854775807L)
251# else
d060cd00
SE
252# if __WORDSIZE32_PTRDIFF_LONG
253# define PTRDIFF_MIN (-2147483647L-1)
254# define PTRDIFF_MAX (2147483647L)
255# else
256# define PTRDIFF_MIN (-2147483647-1)
257# define PTRDIFF_MAX (2147483647)
258# endif
1c25bcac
UD
259# endif
260
261/* Limits of `sig_atomic_t'. */
262# define SIG_ATOMIC_MIN (-2147483647-1)
263# define SIG_ATOMIC_MAX (2147483647)
264
265/* Limit of `size_t' type. */
266# if __WORDSIZE == 64
267# define SIZE_MAX (18446744073709551615UL)
268# else
d060cd00 269# if __WORDSIZE32_SIZE_ULONG
26011b5c
SL
270# define SIZE_MAX (4294967295UL)
271# else
272# define SIZE_MAX (4294967295U)
273# endif
1c25bcac
UD
274# endif
275
276/* Limits of `wchar_t'. */
277# ifndef WCHAR_MIN
278/* These constants might also be defined in <wchar.h>. */
417bafec
UD
279# define WCHAR_MIN __WCHAR_MIN
280# define WCHAR_MAX __WCHAR_MAX
1c25bcac
UD
281# endif
282
283/* Limits of `wint_t'. */
417bafec 284# define WINT_MIN (0u)
81068e35 285# define WINT_MAX (4294967295u)
1c25bcac 286
1c25bcac
UD
287/* Signed. */
288# define INT8_C(c) c
289# define INT16_C(c) c
290# define INT32_C(c) c
291# if __WORDSIZE == 64
292# define INT64_C(c) c ## L
293# else
294# define INT64_C(c) c ## LL
295# endif
296
297/* Unsigned. */
4c3f81d0
UD
298# define UINT8_C(c) c
299# define UINT16_C(c) c
1c25bcac
UD
300# define UINT32_C(c) c ## U
301# if __WORDSIZE == 64
302# define UINT64_C(c) c ## UL
303# else
304# define UINT64_C(c) c ## ULL
305# endif
306
307/* Maximal type. */
308# if __WORDSIZE == 64
309# define INTMAX_C(c) c ## L
310# define UINTMAX_C(c) c ## UL
311# else
312# define INTMAX_C(c) c ## LL
313# define UINTMAX_C(c) c ## ULL
314# endif
315
5b17fd0d
JM
316#if __GLIBC_USE (IEC_60559_BFP_EXT)
317
318# define INT8_WIDTH 8
319# define UINT8_WIDTH 8
320# define INT16_WIDTH 16
321# define UINT16_WIDTH 16
322# define INT32_WIDTH 32
323# define UINT32_WIDTH 32
324# define INT64_WIDTH 64
325# define UINT64_WIDTH 64
326
327# define INT_LEAST8_WIDTH 8
328# define UINT_LEAST8_WIDTH 8
329# define INT_LEAST16_WIDTH 16
330# define UINT_LEAST16_WIDTH 16
331# define INT_LEAST32_WIDTH 32
332# define UINT_LEAST32_WIDTH 32
333# define INT_LEAST64_WIDTH 64
334# define UINT_LEAST64_WIDTH 64
335
336# define INT_FAST8_WIDTH 8
337# define UINT_FAST8_WIDTH 8
338# define INT_FAST16_WIDTH __WORDSIZE
339# define UINT_FAST16_WIDTH __WORDSIZE
340# define INT_FAST32_WIDTH __WORDSIZE
341# define UINT_FAST32_WIDTH __WORDSIZE
342# define INT_FAST64_WIDTH 64
343# define UINT_FAST64_WIDTH 64
344
345# define INTPTR_WIDTH __WORDSIZE
346# define UINTPTR_WIDTH __WORDSIZE
347
348# define INTMAX_WIDTH 64
349# define UINTMAX_WIDTH 64
350
351# define PTRDIFF_WIDTH __WORDSIZE
352# define SIG_ATOMIC_WIDTH 32
353# define SIZE_WIDTH __WORDSIZE
354# define WCHAR_WIDTH 32
355# define WINT_WIDTH 32
356
357#endif
358
1c25bcac 359#endif /* stdint.h */