xref: /minix3/sys/arch/i386/include/int_limits.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: int_limits.h,v 1.9 2014/07/25 21:43:13 joerg Exp $	*/
2f6aac1c3SLionel Sambuc 
3f6aac1c3SLionel Sambuc /*-
4f6aac1c3SLionel Sambuc  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5f6aac1c3SLionel Sambuc  * All rights reserved.
6f6aac1c3SLionel Sambuc  *
7f6aac1c3SLionel Sambuc  * This code is derived from software contributed to The NetBSD Foundation
8f6aac1c3SLionel Sambuc  * by Klaus Klein.
9f6aac1c3SLionel Sambuc  *
10f6aac1c3SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
11f6aac1c3SLionel Sambuc  * modification, are permitted provided that the following conditions
12f6aac1c3SLionel Sambuc  * are met:
13f6aac1c3SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14f6aac1c3SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15f6aac1c3SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16f6aac1c3SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17f6aac1c3SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18f6aac1c3SLionel Sambuc  *
19f6aac1c3SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20f6aac1c3SLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21f6aac1c3SLionel Sambuc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22f6aac1c3SLionel Sambuc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23f6aac1c3SLionel Sambuc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24f6aac1c3SLionel Sambuc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25f6aac1c3SLionel Sambuc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26f6aac1c3SLionel Sambuc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27f6aac1c3SLionel Sambuc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28f6aac1c3SLionel Sambuc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29f6aac1c3SLionel Sambuc  * POSSIBILITY OF SUCH DAMAGE.
30f6aac1c3SLionel Sambuc  */
31f6aac1c3SLionel Sambuc 
32f6aac1c3SLionel Sambuc #ifndef _I386_INT_LIMITS_H_
33f6aac1c3SLionel Sambuc #define _I386_INT_LIMITS_H_
34f6aac1c3SLionel Sambuc 
35*0a6a1f1dSLionel Sambuc #ifdef __SIG_ATOMIC_MAX__
36*0a6a1f1dSLionel Sambuc #include <sys/common_int_limits.h>
37*0a6a1f1dSLionel Sambuc #else
38*0a6a1f1dSLionel Sambuc 
39f6aac1c3SLionel Sambuc /*
40f6aac1c3SLionel Sambuc  * 7.18.2 Limits of specified-width integer types
41f6aac1c3SLionel Sambuc  */
42f6aac1c3SLionel Sambuc 
43f6aac1c3SLionel Sambuc /* 7.18.2.1 Limits of exact-width integer types */
44f6aac1c3SLionel Sambuc 
45f6aac1c3SLionel Sambuc /* minimum values of exact-width signed integer types */
46f6aac1c3SLionel Sambuc #define	INT8_MIN	(-0x7f-1)			/* int8_t	  */
47f6aac1c3SLionel Sambuc #define	INT16_MIN	(-0x7fff-1)			/* int16_t	  */
48f6aac1c3SLionel Sambuc #define	INT32_MIN	(-0x7fffffff-1)			/* int32_t	  */
49f6aac1c3SLionel Sambuc #define	INT64_MIN	(-0x7fffffffffffffffLL-1)	/* int64_t	  */
50f6aac1c3SLionel Sambuc 
51f6aac1c3SLionel Sambuc /* maximum values of exact-width signed integer types */
52f6aac1c3SLionel Sambuc #define	INT8_MAX	0x7f				/* int8_t	  */
53f6aac1c3SLionel Sambuc #define	INT16_MAX	0x7fff				/* int16_t	  */
54f6aac1c3SLionel Sambuc #define	INT32_MAX	0x7fffffff			/* int32_t	  */
55f6aac1c3SLionel Sambuc #define	INT64_MAX	0x7fffffffffffffffLL		/* int64_t	  */
56f6aac1c3SLionel Sambuc 
57f6aac1c3SLionel Sambuc /* maximum values of exact-width unsigned integer types */
58f6aac1c3SLionel Sambuc #define	UINT8_MAX	0xff				/* uint8_t	  */
59f6aac1c3SLionel Sambuc #define	UINT16_MAX	0xffff				/* uint16_t	  */
60f6aac1c3SLionel Sambuc #define	UINT32_MAX	0xffffffffU			/* uint32_t	  */
61f6aac1c3SLionel Sambuc #define	UINT64_MAX	0xffffffffffffffffULL		/* uint64_t	  */
62f6aac1c3SLionel Sambuc 
63f6aac1c3SLionel Sambuc /* 7.18.2.2 Limits of minimum-width integer types */
64f6aac1c3SLionel Sambuc 
65f6aac1c3SLionel Sambuc /* minimum values of minimum-width signed integer types */
66f6aac1c3SLionel Sambuc #define	INT_LEAST8_MIN	(-0x7f-1)			/* int_least8_t	  */
67f6aac1c3SLionel Sambuc #define	INT_LEAST16_MIN	(-0x7fff-1)			/* int_least16_t  */
68f6aac1c3SLionel Sambuc #define	INT_LEAST32_MIN	(-0x7fffffff-1)			/* int_least32_t  */
69f6aac1c3SLionel Sambuc #define	INT_LEAST64_MIN	(-0x7fffffffffffffffLL-1)	/* int_least64_t  */
70f6aac1c3SLionel Sambuc 
71f6aac1c3SLionel Sambuc /* maximum values of minimum-width signed integer types */
72f6aac1c3SLionel Sambuc #define	INT_LEAST8_MAX	0x7f				/* int_least8_t	  */
73f6aac1c3SLionel Sambuc #define	INT_LEAST16_MAX	0x7fff				/* int_least16_t  */
74f6aac1c3SLionel Sambuc #define	INT_LEAST32_MAX	0x7fffffff			/* int_least32_t  */
75f6aac1c3SLionel Sambuc #define	INT_LEAST64_MAX	0x7fffffffffffffffLL		/* int_least64_t  */
76f6aac1c3SLionel Sambuc 
77f6aac1c3SLionel Sambuc /* maximum values of minimum-width unsigned integer types */
78f6aac1c3SLionel Sambuc #define	UINT_LEAST8_MAX	 0xff				/* uint_least8_t  */
79f6aac1c3SLionel Sambuc #define	UINT_LEAST16_MAX 0xffff				/* uint_least16_t */
80f6aac1c3SLionel Sambuc #define	UINT_LEAST32_MAX 0xffffffffU			/* uint_least32_t */
81f6aac1c3SLionel Sambuc #define	UINT_LEAST64_MAX 0xffffffffffffffffULL		/* uint_least64_t */
82f6aac1c3SLionel Sambuc 
83f6aac1c3SLionel Sambuc /* 7.18.2.3 Limits of fastest minimum-width integer types */
84f6aac1c3SLionel Sambuc 
85f6aac1c3SLionel Sambuc /* minimum values of fastest minimum-width signed integer types */
86f6aac1c3SLionel Sambuc #define	INT_FAST8_MIN	(-0x7f-1)			/* int_fast8_t	  */
87f6aac1c3SLionel Sambuc #define	INT_FAST16_MIN	(-0x7fffffff-1)			/* int_fast16_t	  */
88f6aac1c3SLionel Sambuc #define	INT_FAST32_MIN	(-0x7fffffff-1)			/* int_fast32_t	  */
89f6aac1c3SLionel Sambuc #define	INT_FAST64_MIN	(-0x7fffffffffffffffLL-1)	/* int_fast64_t	  */
90f6aac1c3SLionel Sambuc 
91f6aac1c3SLionel Sambuc /* maximum values of fastest minimum-width signed integer types */
92f6aac1c3SLionel Sambuc #define	INT_FAST8_MAX	0x7f				/* int_fast8_t	  */
93f6aac1c3SLionel Sambuc #define	INT_FAST16_MAX	0x7fffffff			/* int_fast16_t	  */
94f6aac1c3SLionel Sambuc #define	INT_FAST32_MAX	0x7fffffff			/* int_fast32_t	  */
95f6aac1c3SLionel Sambuc #define	INT_FAST64_MAX	0x7fffffffffffffffLL		/* int_fast64_t	  */
96f6aac1c3SLionel Sambuc 
97f6aac1c3SLionel Sambuc /* maximum values of fastest minimum-width unsigned integer types */
98f6aac1c3SLionel Sambuc #define	UINT_FAST8_MAX	0xff				/* uint_fast8_t	  */
99f6aac1c3SLionel Sambuc #define	UINT_FAST16_MAX	0xffffffffU			/* uint_fast16_t  */
100f6aac1c3SLionel Sambuc #define	UINT_FAST32_MAX	0xffffffffU			/* uint_fast32_t  */
101f6aac1c3SLionel Sambuc #define	UINT_FAST64_MAX	0xffffffffffffffffULL		/* uint_fast64_t  */
102f6aac1c3SLionel Sambuc 
103f6aac1c3SLionel Sambuc /* 7.18.2.4 Limits of integer types capable of holding object pointers */
104f6aac1c3SLionel Sambuc 
105f6aac1c3SLionel Sambuc #define	INTPTR_MIN	(-0x7fffffff-1)			/* intptr_t	  */
106f6aac1c3SLionel Sambuc #define	INTPTR_MAX	0x7fffffff			/* intptr_t	  */
107f6aac1c3SLionel Sambuc #define	UINTPTR_MAX	0xffffffffU			/* uintptr_t	  */
108f6aac1c3SLionel Sambuc 
109f6aac1c3SLionel Sambuc /* 7.18.2.5 Limits of greatest-width integer types */
110f6aac1c3SLionel Sambuc 
111f6aac1c3SLionel Sambuc #define	INTMAX_MIN	(-0x7fffffffffffffffLL-1)	/* intmax_t	  */
112f6aac1c3SLionel Sambuc #define	INTMAX_MAX	0x7fffffffffffffffLL		/* intmax_t	  */
113f6aac1c3SLionel Sambuc #define	UINTMAX_MAX	0xffffffffffffffffULL		/* uintmax_t	  */
114f6aac1c3SLionel Sambuc 
115f6aac1c3SLionel Sambuc 
116f6aac1c3SLionel Sambuc /*
117f6aac1c3SLionel Sambuc  * 7.18.3 Limits of other integer types
118f6aac1c3SLionel Sambuc  */
119f6aac1c3SLionel Sambuc 
120f6aac1c3SLionel Sambuc /* limits of ptrdiff_t */
121f6aac1c3SLionel Sambuc #define	PTRDIFF_MIN	(-0x7fffffff-1)			/* ptrdiff_t	  */
122f6aac1c3SLionel Sambuc #define	PTRDIFF_MAX	0x7fffffff			/* ptrdiff_t	  */
123f6aac1c3SLionel Sambuc 
124f6aac1c3SLionel Sambuc /* limits of sig_atomic_t */
125f6aac1c3SLionel Sambuc #define	SIG_ATOMIC_MIN	(-0x7fffffff-1)			/* sig_atomic_t	  */
126f6aac1c3SLionel Sambuc #define	SIG_ATOMIC_MAX	0x7fffffff			/* sig_atomic_t	  */
127f6aac1c3SLionel Sambuc 
128f6aac1c3SLionel Sambuc /* limit of size_t */
129f6aac1c3SLionel Sambuc #define	SIZE_MAX	0xffffffffU			/* size_t	  */
130f6aac1c3SLionel Sambuc 
131*0a6a1f1dSLionel Sambuc #endif
132*0a6a1f1dSLionel Sambuc 
133f6aac1c3SLionel Sambuc #endif /* !_I386_INT_LIMITS_H_ */
134