1 _stdint.h |
1 /*- |
|
2 * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> |
|
3 * Copyright (c) 2001 The NetBSD Foundation, Inc. |
|
4 * All rights reserved. |
|
5 * |
|
6 * This code is derived from software contributed to The NetBSD Foundation |
|
7 * by Klaus Klein. |
|
8 * |
|
9 * Redistribution and use in source and binary forms, with or without |
|
10 * modification, are permitted provided that the following conditions |
|
11 * are met: |
|
12 * 1. Redistributions of source code must retain the above copyright |
|
13 * notice, this list of conditions and the following disclaimer. |
|
14 * 2. Redistributions in binary form must reproduce the above copyright |
|
15 * notice, this list of conditions and the following disclaimer in the |
|
16 * documentation and/or other materials provided with the distribution. |
|
17 * 4. Neither the name of The NetBSD Foundation nor the names of its |
|
18 * contributors may be used to endorse or promote products derived |
|
19 * from this software without specific prior written permission. |
|
20 * |
|
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
|
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
|
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
|
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
31 * POSSIBILITY OF SUCH DAMAGE. |
|
32 * |
|
33 * $FreeBSD: src/sys/i386/include/_stdint.h,v 1.2 2004/05/18 16:04:57 stefanf Exp $ |
|
34 */ |
|
35 |
|
36 #ifndef _MACHINE__STDINT_H_ |
|
37 #define _MACHINE__STDINT_H_ |
|
38 |
|
39 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) |
|
40 |
|
41 #define INT8_C(c) (c) |
|
42 #define INT16_C(c) (c) |
|
43 #define INT32_C(c) (c) |
|
44 #define INT64_C(c) (c ## LL) |
|
45 |
|
46 #define UINT8_C(c) (c) |
|
47 #define UINT16_C(c) (c) |
|
48 #define UINT32_C(c) (c ## U) |
|
49 #define UINT64_C(c) (c ## ULL) |
|
50 |
|
51 #define INTMAX_C(c) (c ## LL) |
|
52 #define UINTMAX_C(c) (c ## ULL) |
|
53 |
|
54 #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ |
|
55 |
|
56 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) |
|
57 |
|
58 /* |
|
59 * ISO/IEC 9899:1999 |
|
60 * 7.18.2.1 Limits of exact-width integer types |
|
61 */ |
|
62 /* Minimum values of exact-width signed integer types. */ |
|
63 #define INT8_MIN (-0x7f-1) |
|
64 #define INT16_MIN (-0x7fff-1) |
|
65 #define INT32_MIN (-0x7fffffff-1) |
|
66 #define INT64_MIN (-0x7fffffffffffffffLL-1) |
|
67 |
|
68 /* Maximum values of exact-width signed integer types. */ |
|
69 #define INT8_MAX 0x7f |
|
70 #define INT16_MAX 0x7fff |
|
71 #define INT32_MAX 0x7fffffff |
|
72 #define INT64_MAX 0x7fffffffffffffffLL |
|
73 |
|
74 /* Maximum values of exact-width unsigned integer types. */ |
|
75 #define UINT8_MAX 0xff |
|
76 #define UINT16_MAX 0xffff |
|
77 #define UINT32_MAX 0xffffffffU |
|
78 #define UINT64_MAX 0xffffffffffffffffULL |
|
79 |
|
80 /* |
|
81 * ISO/IEC 9899:1999 |
|
82 * 7.18.2.2 Limits of minimum-width integer types |
|
83 */ |
|
84 /* Minimum values of minimum-width signed integer types. */ |
|
85 #define INT_LEAST8_MIN INT8_MIN |
|
86 #define INT_LEAST16_MIN INT16_MIN |
|
87 #define INT_LEAST32_MIN INT32_MIN |
|
88 #define INT_LEAST64_MIN INT64_MIN |
|
89 |
|
90 /* Maximum values of minimum-width signed integer types. */ |
|
91 #define INT_LEAST8_MAX INT8_MAX |
|
92 #define INT_LEAST16_MAX INT16_MAX |
|
93 #define INT_LEAST32_MAX INT32_MAX |
|
94 #define INT_LEAST64_MAX INT64_MAX |
|
95 |
|
96 /* Maximum values of minimum-width unsigned integer types. */ |
|
97 #define UINT_LEAST8_MAX UINT8_MAX |
|
98 #define UINT_LEAST16_MAX UINT16_MAX |
|
99 #define UINT_LEAST32_MAX UINT32_MAX |
|
100 #define UINT_LEAST64_MAX UINT64_MAX |
|
101 |
|
102 /* |
|
103 * ISO/IEC 9899:1999 |
|
104 * 7.18.2.3 Limits of fastest minimum-width integer types |
|
105 */ |
|
106 /* Minimum values of fastest minimum-width signed integer types. */ |
|
107 #define INT_FAST8_MIN INT32_MIN |
|
108 #define INT_FAST16_MIN INT32_MIN |
|
109 #define INT_FAST32_MIN INT32_MIN |
|
110 #define INT_FAST64_MIN INT64_MIN |
|
111 |
|
112 /* Maximum values of fastest minimum-width signed integer types. */ |
|
113 #define INT_FAST8_MAX INT32_MAX |
|
114 #define INT_FAST16_MAX INT32_MAX |
|
115 #define INT_FAST32_MAX INT32_MAX |
|
116 #define INT_FAST64_MAX INT64_MAX |
|
117 |
|
118 /* Maximum values of fastest minimum-width unsigned integer types. */ |
|
119 #define UINT_FAST8_MAX UINT32_MAX |
|
120 #define UINT_FAST16_MAX UINT32_MAX |
|
121 #define UINT_FAST32_MAX UINT32_MAX |
|
122 #define UINT_FAST64_MAX UINT64_MAX |
|
123 |
|
124 /* |
|
125 * ISO/IEC 9899:1999 |
|
126 * 7.18.2.4 Limits of integer types capable of holding object pointers |
|
127 */ |
|
128 #define INTPTR_MIN INT32_MIN |
|
129 #define INTPTR_MAX INT32_MAX |
|
130 #define UINTPTR_MAX UINT32_MAX |
|
131 |
|
132 /* |
|
133 * ISO/IEC 9899:1999 |
|
134 * 7.18.2.5 Limits of greatest-width integer types |
|
135 */ |
|
136 #define INTMAX_MIN INT64_MIN |
|
137 #define INTMAX_MAX INT64_MAX |
|
138 #define UINTMAX_MAX UINT64_MAX |
|
139 |
|
140 /* |
|
141 * ISO/IEC 9899:1999 |
|
142 * 7.18.3 Limits of other integer types |
|
143 */ |
|
144 /* Limits of ptrdiff_t. */ |
|
145 #define PTRDIFF_MIN INT32_MIN |
|
146 #define PTRDIFF_MAX INT32_MAX |
|
147 |
|
148 /* Limits of sig_atomic_t. */ |
|
149 #define SIG_ATOMIC_MIN INT32_MIN |
|
150 #define SIG_ATOMIC_MAX INT32_MAX |
|
151 |
|
152 /* Limit of size_t. */ |
|
153 #define SIZE_MAX UINT32_MAX |
|
154 |
|
155 #ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */ |
|
156 /* Limits of wchar_t. */ |
|
157 #define WCHAR_MIN INT32_MIN |
|
158 #define WCHAR_MAX INT32_MAX |
|
159 #endif |
|
160 |
|
161 /* Limits of wint_t. */ |
|
162 #define WINT_MIN INT32_MIN |
|
163 #define WINT_MAX INT32_MAX |
|
164 |
|
165 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ |
|
166 |
|
167 #endif /* !_MACHINE__STDINT_H_ */ |