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