xref: /titanic_51/usr/src/boot/sys/x86/include/_limits.h (revision 4a5d661a82b942b6538acd26209d959ce98b593a)
1*4a5d661aSToomas Soome /*-
2*4a5d661aSToomas Soome  * Copyright (c) 1988, 1993
3*4a5d661aSToomas Soome  *	The Regents of the University of California.  All rights reserved.
4*4a5d661aSToomas Soome  *
5*4a5d661aSToomas Soome  * Redistribution and use in source and binary forms, with or without
6*4a5d661aSToomas Soome  * modification, are permitted provided that the following conditions
7*4a5d661aSToomas Soome  * are met:
8*4a5d661aSToomas Soome  * 1. Redistributions of source code must retain the above copyright
9*4a5d661aSToomas Soome  *    notice, this list of conditions and the following disclaimer.
10*4a5d661aSToomas Soome  * 2. Redistributions in binary form must reproduce the above copyright
11*4a5d661aSToomas Soome  *    notice, this list of conditions and the following disclaimer in the
12*4a5d661aSToomas Soome  *    documentation and/or other materials provided with the distribution.
13*4a5d661aSToomas Soome  * 4. Neither the name of the University nor the names of its contributors
14*4a5d661aSToomas Soome  *    may be used to endorse or promote products derived from this software
15*4a5d661aSToomas Soome  *    without specific prior written permission.
16*4a5d661aSToomas Soome  *
17*4a5d661aSToomas Soome  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18*4a5d661aSToomas Soome  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*4a5d661aSToomas Soome  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*4a5d661aSToomas Soome  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21*4a5d661aSToomas Soome  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*4a5d661aSToomas Soome  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*4a5d661aSToomas Soome  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*4a5d661aSToomas Soome  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*4a5d661aSToomas Soome  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*4a5d661aSToomas Soome  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*4a5d661aSToomas Soome  * SUCH DAMAGE.
28*4a5d661aSToomas Soome  *
29*4a5d661aSToomas Soome  *	@(#)limits.h	8.3 (Berkeley) 1/4/94
30*4a5d661aSToomas Soome  * $FreeBSD$
31*4a5d661aSToomas Soome  */
32*4a5d661aSToomas Soome 
33*4a5d661aSToomas Soome #ifndef	_MACHINE__LIMITS_H_
34*4a5d661aSToomas Soome #define	_MACHINE__LIMITS_H_
35*4a5d661aSToomas Soome 
36*4a5d661aSToomas Soome /*
37*4a5d661aSToomas Soome  * According to ANSI (section 2.2.4.2), the values below must be usable by
38*4a5d661aSToomas Soome  * #if preprocessing directives.  Additionally, the expression must have the
39*4a5d661aSToomas Soome  * same type as would an expression that is an object of the corresponding
40*4a5d661aSToomas Soome  * type converted according to the integral promotions.  The subtraction for
41*4a5d661aSToomas Soome  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
42*4a5d661aSToomas Soome  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
43*4a5d661aSToomas Soome  */
44*4a5d661aSToomas Soome 
45*4a5d661aSToomas Soome #define	__CHAR_BIT	8		/* number of bits in a char */
46*4a5d661aSToomas Soome 
47*4a5d661aSToomas Soome #define	__SCHAR_MAX	0x7f		/* max value for a signed char */
48*4a5d661aSToomas Soome #define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
49*4a5d661aSToomas Soome 
50*4a5d661aSToomas Soome #define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
51*4a5d661aSToomas Soome 
52*4a5d661aSToomas Soome #define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
53*4a5d661aSToomas Soome #define	__SHRT_MAX	0x7fff		/* max value for a short */
54*4a5d661aSToomas Soome #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
55*4a5d661aSToomas Soome 
56*4a5d661aSToomas Soome #define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
57*4a5d661aSToomas Soome #define	__INT_MAX	0x7fffffff	/* max value for an int */
58*4a5d661aSToomas Soome #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
59*4a5d661aSToomas Soome 
60*4a5d661aSToomas Soome #ifdef	__LP64__
61*4a5d661aSToomas Soome #define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
62*4a5d661aSToomas Soome #define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
63*4a5d661aSToomas Soome #define	__LONG_MIN	(-0x7fffffffffffffff - 1) /* min for a long */
64*4a5d661aSToomas Soome #else
65*4a5d661aSToomas Soome #define	__ULONG_MAX	0xffffffffUL
66*4a5d661aSToomas Soome #define	__LONG_MAX	0x7fffffffL
67*4a5d661aSToomas Soome #define	__LONG_MIN	(-0x7fffffffL - 1)
68*4a5d661aSToomas Soome #endif
69*4a5d661aSToomas Soome 
70*4a5d661aSToomas Soome 			/* max value for an unsigned long long */
71*4a5d661aSToomas Soome #define	__ULLONG_MAX	0xffffffffffffffffULL
72*4a5d661aSToomas Soome #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
73*4a5d661aSToomas Soome #define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
74*4a5d661aSToomas Soome 
75*4a5d661aSToomas Soome #ifdef	__LP64__
76*4a5d661aSToomas Soome #define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
77*4a5d661aSToomas Soome #define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
78*4a5d661aSToomas Soome #define	__OFF_MAX	__LONG_MAX	/* max value for an off_t */
79*4a5d661aSToomas Soome #define	__OFF_MIN	__LONG_MIN	/* min value for an off_t */
80*4a5d661aSToomas Soome /* Quads and longs are the same on the amd64.  Ensure they stay in sync. */
81*4a5d661aSToomas Soome #define	__UQUAD_MAX	__ULONG_MAX	/* max value for a uquad_t */
82*4a5d661aSToomas Soome #define	__QUAD_MAX	__LONG_MAX	/* max value for a quad_t */
83*4a5d661aSToomas Soome #define	__QUAD_MIN	__LONG_MIN	/* min value for a quad_t */
84*4a5d661aSToomas Soome #define	__LONG_BIT	64
85*4a5d661aSToomas Soome #else
86*4a5d661aSToomas Soome #define	__SSIZE_MAX	__INT_MAX
87*4a5d661aSToomas Soome #define	__SIZE_T_MAX	__UINT_MAX
88*4a5d661aSToomas Soome #define	__OFF_MAX	__LLONG_MAX
89*4a5d661aSToomas Soome #define	__OFF_MIN	__LLONG_MIN
90*4a5d661aSToomas Soome #define	__UQUAD_MAX	__ULLONG_MAX
91*4a5d661aSToomas Soome #define	__QUAD_MAX	__LLONG_MAX
92*4a5d661aSToomas Soome #define	__QUAD_MIN	__LLONG_MIN
93*4a5d661aSToomas Soome #define	__LONG_BIT	32
94*4a5d661aSToomas Soome #endif
95*4a5d661aSToomas Soome 
96*4a5d661aSToomas Soome #define	__WORD_BIT	32
97*4a5d661aSToomas Soome 
98*4a5d661aSToomas Soome /* Minimum signal stack size. */
99*4a5d661aSToomas Soome #define	__MINSIGSTKSZ	(512 * 4)
100*4a5d661aSToomas Soome 
101*4a5d661aSToomas Soome #endif /* !_MACHINE__LIMITS_H_ */
102