]> CyberLeo.Net >> Repos - FreeBSD/releng/8.2.git/blob - sys/mips/include/_stdint.h
Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.
[FreeBSD/releng/8.2.git] / sys / mips / include / _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  * 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$
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 #ifdef __mips_n64
50 #define INT64_C(c)              (c ## L)
51 #else
52 #define INT64_C(c)              (c ## LL)
53 #endif
54
55 #define UINT8_C(c)              (c)
56 #define UINT16_C(c)             (c)
57 #define UINT32_C(c)             (c ## U)
58 #ifdef __mips_n64
59 #define UINT64_C(c)             (c ## UL)
60 #else
61 #define UINT64_C(c)             (c ## ULL)
62 #endif
63
64 #ifdef __mips_n64
65 #define INTMAX_C(c)             (c ## L)
66 #define UINTMAX_C(c)            (c ## UL)
67 #else
68 #define INTMAX_C(c)             (c ## LL)
69 #define UINTMAX_C(c)            (c ## ULL)
70 #endif
71
72 #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
73
74 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
75
76 /*
77  * ISO/IEC 9899:1999
78  * 7.18.2.1 Limits of exact-width integer types
79  */
80 /* Minimum values of exact-width signed integer types. */
81 #define INT8_MIN        (-0x7f-1)
82 #define INT16_MIN       (-0x7fff-1)
83 #define INT32_MIN       (-0x7fffffff-1)
84 #define INT64_MIN       (-INTMAX_C(0x7fffffffffffffff)-1)
85
86 /* Maximum values of exact-width signed integer types. */
87 #define INT8_MAX        0x7f
88 #define INT16_MAX       0x7fff
89 #define INT32_MAX       0x7fffffff
90 #define INT64_MAX       INTMAX_C(0x7fffffffffffffff)
91
92 /* Maximum values of exact-width unsigned integer types. */
93 #define UINT8_MAX       0xff
94 #define UINT16_MAX      0xffff
95 #define UINT32_MAX      0xffffffffU
96 #define UINT64_MAX      UINTMAX_C(0xffffffffffffffff)
97
98 /*
99  * ISO/IEC 9899:1999
100  * 7.18.2.2  Limits of minimum-width integer types
101  */
102 /* Minimum values of minimum-width signed integer types. */
103 #define INT_LEAST8_MIN  INT8_MIN
104 #define INT_LEAST16_MIN INT16_MIN
105 #define INT_LEAST32_MIN INT32_MIN
106 #define INT_LEAST64_MIN INT64_MIN
107
108 /* Maximum values of minimum-width signed integer types. */
109 #define INT_LEAST8_MAX  INT8_MAX
110 #define INT_LEAST16_MAX INT16_MAX
111 #define INT_LEAST32_MAX INT32_MAX
112 #define INT_LEAST64_MAX INT64_MAX
113
114 /* Maximum values of minimum-width unsigned integer types. */
115 #define UINT_LEAST8_MAX  UINT8_MAX
116 #define UINT_LEAST16_MAX UINT16_MAX
117 #define UINT_LEAST32_MAX UINT32_MAX
118 #define UINT_LEAST64_MAX UINT64_MAX
119
120 /*
121  * ISO/IEC 9899:1999
122  * 7.18.2.3  Limits of fastest minimum-width integer types
123  */
124 /* Minimum values of fastest minimum-width signed integer types. */
125 #define INT_FAST8_MIN   INT32_MIN
126 #define INT_FAST16_MIN  INT32_MIN
127 #define INT_FAST32_MIN  INT32_MIN
128 #define INT_FAST64_MIN  INT64_MIN
129
130 /* Maximum values of fastest minimum-width signed integer types. */
131 #define INT_FAST8_MAX   INT32_MAX
132 #define INT_FAST16_MAX  INT32_MAX
133 #define INT_FAST32_MAX  INT32_MAX
134 #define INT_FAST64_MAX  INT64_MAX
135
136 /* Maximum values of fastest minimum-width unsigned integer types. */
137 #define UINT_FAST8_MAX  UINT32_MAX
138 #define UINT_FAST16_MAX UINT32_MAX
139 #define UINT_FAST32_MAX UINT32_MAX
140 #define UINT_FAST64_MAX UINT64_MAX
141
142 /*
143  * ISO/IEC 9899:1999
144  * 7.18.2.4  Limits of integer types capable of holding object pointers
145  */
146 #ifdef __mips_n64
147 #define INTPTR_MIN      INT64_MIN
148 #define INTPTR_MAX      INT64_MAX
149 #define UINTPTR_MAX     UINT64_MAX
150 #else
151 #define INTPTR_MIN      INT32_MIN
152 #define INTPTR_MAX      INT32_MAX
153 #define UINTPTR_MAX     UINT32_MAX
154 #endif
155
156 /*
157  * ISO/IEC 9899:1999
158  * 7.18.2.5  Limits of greatest-width integer types
159  */
160 #define INTMAX_MIN      INT64_MIN
161 #define INTMAX_MAX      INT64_MAX
162 #define UINTMAX_MAX     UINT64_MAX
163
164 /*
165  * ISO/IEC 9899:1999
166  * 7.18.3  Limits of other integer types
167  */
168 /* Limits of ptrdiff_t. */
169 #ifdef __mips_n64
170 #define PTRDIFF_MIN     INT64_MIN
171 #define PTRDIFF_MAX     INT64_MAX
172 #else
173 #define PTRDIFF_MIN     INT32_MIN
174 #define PTRDIFF_MAX     INT32_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 /* Limit of size_t. */
182 #ifdef __mips_n64
183 #define SIZE_MAX        UINT64_MAX
184 #else
185 #define SIZE_MAX        UINT32_MAX
186 #endif
187
188 #ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */
189 /* Limits of wchar_t. */
190 #define WCHAR_MIN       INT32_MIN
191 #define WCHAR_MAX       INT32_MAX
192 #endif
193
194 /* Limits of wint_t. */
195 #define WINT_MIN        INT32_MIN
196 #define WINT_MAX        INT32_MAX
197
198 #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
199
200 #endif /* !_MACHINE__STDINT_H_ */