xref: /freebsd/sys/x86/include/_limits.h (revision 8bed40c9fe84015ff4e2ddeb54aa3207e7fa5375)
18cfa93e4STijl Coosemans /*-
28cfa93e4STijl Coosemans  * Copyright (c) 1988, 1993
38cfa93e4STijl Coosemans  *	The Regents of the University of California.  All rights reserved.
48cfa93e4STijl Coosemans  *
58cfa93e4STijl Coosemans  * Redistribution and use in source and binary forms, with or without
68cfa93e4STijl Coosemans  * modification, are permitted provided that the following conditions
78cfa93e4STijl Coosemans  * are met:
88cfa93e4STijl Coosemans  * 1. Redistributions of source code must retain the above copyright
98cfa93e4STijl Coosemans  *    notice, this list of conditions and the following disclaimer.
108cfa93e4STijl Coosemans  * 2. Redistributions in binary form must reproduce the above copyright
118cfa93e4STijl Coosemans  *    notice, this list of conditions and the following disclaimer in the
128cfa93e4STijl Coosemans  *    documentation and/or other materials provided with the distribution.
138cfa93e4STijl Coosemans  * 4. Neither the name of the University nor the names of its contributors
148cfa93e4STijl Coosemans  *    may be used to endorse or promote products derived from this software
158cfa93e4STijl Coosemans  *    without specific prior written permission.
168cfa93e4STijl Coosemans  *
178cfa93e4STijl Coosemans  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
188cfa93e4STijl Coosemans  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
198cfa93e4STijl Coosemans  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
208cfa93e4STijl Coosemans  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
218cfa93e4STijl Coosemans  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
228cfa93e4STijl Coosemans  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
238cfa93e4STijl Coosemans  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
248cfa93e4STijl Coosemans  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
258cfa93e4STijl Coosemans  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
268cfa93e4STijl Coosemans  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
278cfa93e4STijl Coosemans  * SUCH DAMAGE.
288cfa93e4STijl Coosemans  *
298cfa93e4STijl Coosemans  *	@(#)limits.h	8.3 (Berkeley) 1/4/94
308cfa93e4STijl Coosemans  * $FreeBSD$
318cfa93e4STijl Coosemans  */
328cfa93e4STijl Coosemans 
338cfa93e4STijl Coosemans #ifndef	_MACHINE__LIMITS_H_
348cfa93e4STijl Coosemans #define	_MACHINE__LIMITS_H_
358cfa93e4STijl Coosemans 
368cfa93e4STijl Coosemans /*
378cfa93e4STijl Coosemans  * According to ANSI (section 2.2.4.2), the values below must be usable by
388cfa93e4STijl Coosemans  * #if preprocessing directives.  Additionally, the expression must have the
398cfa93e4STijl Coosemans  * same type as would an expression that is an object of the corresponding
408cfa93e4STijl Coosemans  * type converted according to the integral promotions.  The subtraction for
418cfa93e4STijl Coosemans  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
428cfa93e4STijl Coosemans  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
438cfa93e4STijl Coosemans  */
448cfa93e4STijl Coosemans 
458cfa93e4STijl Coosemans #define	__CHAR_BIT	8		/* number of bits in a char */
468cfa93e4STijl Coosemans 
478cfa93e4STijl Coosemans #define	__SCHAR_MAX	0x7f		/* max value for a signed char */
488cfa93e4STijl Coosemans #define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
498cfa93e4STijl Coosemans 
508cfa93e4STijl Coosemans #define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
518cfa93e4STijl Coosemans 
528cfa93e4STijl Coosemans #define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
538cfa93e4STijl Coosemans #define	__SHRT_MAX	0x7fff		/* max value for a short */
548cfa93e4STijl Coosemans #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
558cfa93e4STijl Coosemans 
568cfa93e4STijl Coosemans #define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
578cfa93e4STijl Coosemans #define	__INT_MAX	0x7fffffff	/* max value for an int */
588cfa93e4STijl Coosemans #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
598cfa93e4STijl Coosemans 
60*8bed40c9SDavid E. O'Brien #ifdef	__LP64__
618cfa93e4STijl Coosemans #define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
628cfa93e4STijl Coosemans #define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
638cfa93e4STijl Coosemans #define	__LONG_MIN	(-0x7fffffffffffffff - 1) /* min for a long */
648cfa93e4STijl Coosemans #else
658cfa93e4STijl Coosemans #define	__ULONG_MAX	0xffffffffUL
668cfa93e4STijl Coosemans #define	__LONG_MAX	0x7fffffffL
678cfa93e4STijl Coosemans #define	__LONG_MIN	(-0x7fffffffL - 1)
688cfa93e4STijl Coosemans #endif
698cfa93e4STijl Coosemans 
708cfa93e4STijl Coosemans 			/* max value for an unsigned long long */
718cfa93e4STijl Coosemans #define	__ULLONG_MAX	0xffffffffffffffffULL
728cfa93e4STijl Coosemans #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
738cfa93e4STijl Coosemans #define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
748cfa93e4STijl Coosemans 
75*8bed40c9SDavid E. O'Brien #ifdef	__LP64__
768cfa93e4STijl Coosemans #define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
778cfa93e4STijl Coosemans #define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
788cfa93e4STijl Coosemans #define	__OFF_MAX	__LONG_MAX	/* max value for an off_t */
798cfa93e4STijl Coosemans #define	__OFF_MIN	__LONG_MIN	/* min value for an off_t */
808cfa93e4STijl Coosemans /* Quads and longs are the same on the amd64.  Ensure they stay in sync. */
818cfa93e4STijl Coosemans #define	__UQUAD_MAX	__ULONG_MAX	/* max value for a uquad_t */
828cfa93e4STijl Coosemans #define	__QUAD_MAX	__LONG_MAX	/* max value for a quad_t */
838cfa93e4STijl Coosemans #define	__QUAD_MIN	__LONG_MIN	/* min value for a quad_t */
848cfa93e4STijl Coosemans #define	__LONG_BIT	64
858cfa93e4STijl Coosemans #else
868cfa93e4STijl Coosemans #define	__SSIZE_MAX	__INT_MAX
878cfa93e4STijl Coosemans #define	__SIZE_T_MAX	__UINT_MAX
888cfa93e4STijl Coosemans #define	__OFF_MAX	__LLONG_MAX
898cfa93e4STijl Coosemans #define	__OFF_MIN	__LLONG_MIN
908cfa93e4STijl Coosemans #define	__UQUAD_MAX	__ULLONG_MAX
918cfa93e4STijl Coosemans #define	__QUAD_MAX	__LLONG_MAX
928cfa93e4STijl Coosemans #define	__QUAD_MIN	__LLONG_MIN
938cfa93e4STijl Coosemans #define	__LONG_BIT	32
948cfa93e4STijl Coosemans #endif
958cfa93e4STijl Coosemans 
968cfa93e4STijl Coosemans #define	__WORD_BIT	32
978cfa93e4STijl Coosemans 
988cfa93e4STijl Coosemans /* Minimum signal stack size. */
998cfa93e4STijl Coosemans #define	__MINSIGSTKSZ	(512 * 4)
1008cfa93e4STijl Coosemans 
1018cfa93e4STijl Coosemans #endif /* !_MACHINE__LIMITS_H_ */
102