2 * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org>
3 * Copyright (c) 2001 The NetBSD Foundation, Inc.
6 * This code is derived from software contributed to The NetBSD Foundation
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the NetBSD
20 * Foundation, Inc. and its contributors.
21 * 4. Neither the name of The NetBSD Foundation nor the names of its
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
37 * from: src/sys/i386/include/_stdint.h,v 1.2 2004/05/18 16:04:57 stefanf
41 #ifndef _MACHINE__STDINT_H_
42 #define _MACHINE__STDINT_H_
44 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
47 #define INT16_C(c) (c)
48 #define INT32_C(c) (c)
50 #define UINT8_C(c) (c)
51 #define UINT16_C(c) (c)
52 #define UINT32_C(c) (c ## U)
55 #define INT64_C(c) (c ## L)
56 #define UINT64_C(c) (c ## UL)
58 #define INT64_C(c) (c ## LL)
59 #define UINT64_C(c) (c ## ULL)
62 #define INTMAX_C(c) INT64_C(c)
63 #define UINTMAX_C(c) UINT64_C(c)
65 #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
67 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
71 #define __INT64_C(c) (c ## L)
72 #define __UINT64_C(c) (c ## UL)
74 #define __INT64_C(c) (c ## LL)
75 #define __UINT64_C(c) (c ## ULL)
81 * 7.18.2.1 Limits of exact-width integer types
83 /* Minimum values of exact-width signed integer types. */
84 #define INT8_MIN (-0x7f-1)
85 #define INT16_MIN (-0x7fff-1)
86 #define INT32_MIN (-0x7fffffff-1)
87 #define INT64_MIN (-__INT64_C(0x7fffffffffffffff)-1)
89 /* Maximum values of exact-width signed integer types. */
91 #define INT16_MAX 0x7fff
92 #define INT32_MAX 0x7fffffff
93 #define INT64_MAX __INT64_C(0x7fffffffffffffff)
95 /* Maximum values of exact-width unsigned integer types. */
96 #define UINT8_MAX 0xff
97 #define UINT16_MAX 0xffff
98 #define UINT32_MAX 0xffffffff
99 #define UINT64_MAX __UINT64_C(0xffffffffffffffff)
103 * 7.18.2.2 Limits of minimum-width integer types
105 /* Minimum values of minimum-width signed integer types. */
106 #define INT_LEAST8_MIN INT8_MIN
107 #define INT_LEAST16_MIN INT16_MIN
108 #define INT_LEAST32_MIN INT32_MIN
109 #define INT_LEAST64_MIN INT64_MIN
111 /* Maximum values of minimum-width signed integer types. */
112 #define INT_LEAST8_MAX INT8_MAX
113 #define INT_LEAST16_MAX INT16_MAX
114 #define INT_LEAST32_MAX INT32_MAX
115 #define INT_LEAST64_MAX INT64_MAX
117 /* Maximum values of minimum-width unsigned integer types. */
118 #define UINT_LEAST8_MAX UINT8_MAX
119 #define UINT_LEAST16_MAX UINT16_MAX
120 #define UINT_LEAST32_MAX UINT32_MAX
121 #define UINT_LEAST64_MAX UINT64_MAX
125 * 7.18.2.3 Limits of fastest minimum-width integer types
127 /* Minimum values of fastest minimum-width signed integer types. */
128 #define INT_FAST8_MIN INT32_MIN
129 #define INT_FAST16_MIN INT32_MIN
130 #define INT_FAST32_MIN INT32_MIN
131 #define INT_FAST64_MIN INT64_MIN
133 /* Maximum values of fastest minimum-width signed integer types. */
134 #define INT_FAST8_MAX INT32_MAX
135 #define INT_FAST16_MAX INT32_MAX
136 #define INT_FAST32_MAX INT32_MAX
137 #define INT_FAST64_MAX INT64_MAX
139 /* Maximum values of fastest minimum-width unsigned integer types. */
140 #define UINT_FAST8_MAX UINT32_MAX
141 #define UINT_FAST16_MAX UINT32_MAX
142 #define UINT_FAST32_MAX UINT32_MAX
143 #define UINT_FAST64_MAX UINT64_MAX
147 * 7.18.2.4 Limits of integer types capable of holding object pointers
150 #define INTPTR_MIN INT64_MIN
151 #define INTPTR_MAX INT64_MAX
152 #define UINTPTR_MAX UINT64_MAX
154 #define INTPTR_MIN INT32_MIN
155 #define INTPTR_MAX INT32_MAX
156 #define UINTPTR_MAX UINT32_MAX
161 * 7.18.2.5 Limits of greatest-width integer types
163 #define INTMAX_MIN INT64_MIN
164 #define INTMAX_MAX INT64_MAX
165 #define UINTMAX_MAX UINT64_MAX
169 * 7.18.3 Limits of other integer types
172 /* Limits of ptrdiff_t. */
173 #define PTRDIFF_MIN INT64_MIN
174 #define PTRDIFF_MAX INT64_MAX
176 /* Limit of size_t. */
177 #define SIZE_MAX UINT64_MAX
179 /* Limits of ptrdiff_t. */
180 #define PTRDIFF_MIN INT32_MIN
181 #define PTRDIFF_MAX INT32_MAX
183 /* Limit of size_t. */
184 #define SIZE_MAX UINT32_MAX
187 /* Limits of sig_atomic_t. */
188 #define SIG_ATOMIC_MIN INT32_MIN
189 #define SIG_ATOMIC_MAX INT32_MAX
191 /* Limits of wint_t. */
192 #define WINT_MIN INT32_MIN
193 #define WINT_MAX INT32_MAX
195 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
197 #endif /* !_MACHINE__STDINT_H_ */