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 * 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.
24 *
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.
36 *
37 * from: src/sys/i386/include/_stdint.h,v 1.2 2004/05/18 16:04:57 stefanf
38 * $FreeBSD: releng/9.0/sys/mips/include/_stdint.h 218266 2011-02-04 13:09:46Z tijl $
39 */
40
41 #ifndef _MACHINE__STDINT_H_
42 #define _MACHINE__STDINT_H_
43
44 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
45
46 #define INT8_C(c) (c)
47 #define INT16_C(c) (c)
48 #define INT32_C(c) (c)
49
50 #define UINT8_C(c) (c)
51 #define UINT16_C(c) (c)
52 #define UINT32_C(c) (c ## U)
53
54 #ifdef __mips_n64
55 #define INT64_C(c) (c ## L)
56 #define UINT64_C(c) (c ## UL)
57 #else
58 #define INT64_C(c) (c ## LL)
59 #define UINT64_C(c) (c ## ULL)
60 #endif
61
62 #define INTMAX_C(c) INT64_C(c)
63 #define UINTMAX_C(c) UINT64_C(c)
64
65 #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
66
67 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
68
69 /*
70 * ISO/IEC 9899:1999
71 * 7.18.2.1 Limits of exact-width integer types
72 */
73 /* Minimum values of exact-width signed integer types. */
74 #define INT8_MIN (-0x7f-1)
75 #define INT16_MIN (-0x7fff-1)
76 #define INT32_MIN (-0x7fffffff-1)
77 #define INT64_MIN (-INT64_C(0x7fffffffffffffff)-1)
78
79 /* Maximum values of exact-width signed integer types. */
80 #define INT8_MAX 0x7f
81 #define INT16_MAX 0x7fff
82 #define INT32_MAX 0x7fffffff
83 #define INT64_MAX INT64_C(0x7fffffffffffffff)
84
85 /* Maximum values of exact-width unsigned integer types. */
86 #define UINT8_MAX 0xff
87 #define UINT16_MAX 0xffff
88 #define UINT32_MAX 0xffffffff
89 #define UINT64_MAX UINT64_C(0xffffffffffffffff)
90
91 /*
92 * ISO/IEC 9899:1999
93 * 7.18.2.2 Limits of minimum-width integer types
94 */
95 /* Minimum values of minimum-width signed integer types. */
96 #define INT_LEAST8_MIN INT8_MIN
97 #define INT_LEAST16_MIN INT16_MIN
98 #define INT_LEAST32_MIN INT32_MIN
99 #define INT_LEAST64_MIN INT64_MIN
100
101 /* Maximum values of minimum-width signed integer types. */
102 #define INT_LEAST8_MAX INT8_MAX
103 #define INT_LEAST16_MAX INT16_MAX
104 #define INT_LEAST32_MAX INT32_MAX
105 #define INT_LEAST64_MAX INT64_MAX
106
107 /* Maximum values of minimum-width unsigned integer types. */
108 #define UINT_LEAST8_MAX UINT8_MAX
109 #define UINT_LEAST16_MAX UINT16_MAX
110 #define UINT_LEAST32_MAX UINT32_MAX
111 #define UINT_LEAST64_MAX UINT64_MAX
112
113 /*
114 * ISO/IEC 9899:1999
115 * 7.18.2.3 Limits of fastest minimum-width integer types
116 */
117 /* Minimum values of fastest minimum-width signed integer types. */
118 #define INT_FAST8_MIN INT32_MIN
119 #define INT_FAST16_MIN INT32_MIN
120 #define INT_FAST32_MIN INT32_MIN
121 #define INT_FAST64_MIN INT64_MIN
122
123 /* Maximum values of fastest minimum-width signed integer types. */
124 #define INT_FAST8_MAX INT32_MAX
125 #define INT_FAST16_MAX INT32_MAX
126 #define INT_FAST32_MAX INT32_MAX
127 #define INT_FAST64_MAX INT64_MAX
128
129 /* Maximum values of fastest minimum-width unsigned integer types. */
130 #define UINT_FAST8_MAX UINT32_MAX
131 #define UINT_FAST16_MAX UINT32_MAX
132 #define UINT_FAST32_MAX UINT32_MAX
133 #define UINT_FAST64_MAX UINT64_MAX
134
135 /*
136 * ISO/IEC 9899:1999
137 * 7.18.2.4 Limits of integer types capable of holding object pointers
138 */
139 #ifdef __mips_n64
140 #define INTPTR_MIN INT64_MIN
141 #define INTPTR_MAX INT64_MAX
142 #define UINTPTR_MAX UINT64_MAX
143 #else
144 #define INTPTR_MIN INT32_MIN
145 #define INTPTR_MAX INT32_MAX
146 #define UINTPTR_MAX UINT32_MAX
147 #endif
148
149 /*
150 * ISO/IEC 9899:1999
151 * 7.18.2.5 Limits of greatest-width integer types
152 */
153 #define INTMAX_MIN INT64_MIN
154 #define INTMAX_MAX INT64_MAX
155 #define UINTMAX_MAX UINT64_MAX
156
157 /*
158 * ISO/IEC 9899:1999
159 * 7.18.3 Limits of other integer types
160 */
161 #ifdef __mips_n64
162 /* Limits of ptrdiff_t. */
163 #define PTRDIFF_MIN INT64_MIN
164 #define PTRDIFF_MAX INT64_MAX
165
166 /* Limit of size_t. */
167 #define SIZE_MAX UINT64_MAX
168 #else
169 /* Limits of ptrdiff_t. */
170 #define PTRDIFF_MIN INT32_MIN
171 #define PTRDIFF_MAX INT32_MAX
172
173 /* Limit of size_t. */
174 #define SIZE_MAX UINT32_MAX
175 #endif
176
177 /* Limits of sig_atomic_t. */
178 #define SIG_ATOMIC_MIN INT32_MIN
179 #define SIG_ATOMIC_MAX INT32_MAX
180
181 #ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
182 /* Limits of wchar_t. */
183 #define WCHAR_MIN INT32_MIN
184 #define WCHAR_MAX INT32_MAX
185 #endif
186
187 /* Limits of wint_t. */
188 #define WINT_MIN INT32_MIN
189 #define WINT_MAX INT32_MAX
190
191 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
192
193 #endif /* !_MACHINE__STDINT_H_ */
Cache object: 047e702076e82169110df6ea6466a3e3
|