xref: /freebsd/sys/powerpc/include/_limits.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
160727d8bSWarner Losh /*-
2*51369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*51369649SPedro F. Giffuni  *
426f9a767SRodney W. Grimes  * Copyright (c) 1988, 1993
526f9a767SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
65b81b6b3SRodney W. Grimes  *
75b81b6b3SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
85b81b6b3SRodney W. Grimes  * modification, are permitted provided that the following conditions
95b81b6b3SRodney W. Grimes  * are met:
105b81b6b3SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
115b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
125b81b6b3SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
135b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
145b81b6b3SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
15fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
165b81b6b3SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
175b81b6b3SRodney W. Grimes  *    without specific prior written permission.
185b81b6b3SRodney W. Grimes  *
195b81b6b3SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
205b81b6b3SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
215b81b6b3SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225b81b6b3SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
235b81b6b3SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
245b81b6b3SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
255b81b6b3SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
265b81b6b3SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
275b81b6b3SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
285b81b6b3SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
295b81b6b3SRodney W. Grimes  * SUCH DAMAGE.
305b81b6b3SRodney W. Grimes  */
315b81b6b3SRodney W. Grimes 
326fd839f9SAlexander Kabaev #ifndef _MACHINE__LIMITS_H_
336fd839f9SAlexander Kabaev #define	_MACHINE__LIMITS_H_
346e393973SGarrett Wollman 
350eda4c08SAlexander Kabaev /*
360eda4c08SAlexander Kabaev  * According to ANSI (section 2.2.4.2), the values below must be usable by
370eda4c08SAlexander Kabaev  * #if preprocessing directives.  Additionally, the expression must have the
380eda4c08SAlexander Kabaev  * same type as would an expression that is an object of the corresponding
390eda4c08SAlexander Kabaev  * type converted according to the integral promotions.  The subtraction for
400eda4c08SAlexander Kabaev  * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
410eda4c08SAlexander Kabaev  * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
420eda4c08SAlexander Kabaev  */
430eda4c08SAlexander Kabaev 
44980ded9aSAlexander Kabaev #define	__CHAR_BIT	8		/* number of bits in a char */
45980ded9aSAlexander Kabaev 
466fd839f9SAlexander Kabaev #define	__SCHAR_MAX	0x7f		/* max value for a signed char */
476fd839f9SAlexander Kabaev #define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
4826f9a767SRodney W. Grimes 
496fd839f9SAlexander Kabaev #define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
5080a29084SAndrey A. Chernov 
516fd839f9SAlexander Kabaev #define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
526fd839f9SAlexander Kabaev #define	__SHRT_MAX	0x7fff		/* max value for a short */
536fd839f9SAlexander Kabaev #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
5426f9a767SRodney W. Grimes 
559858863cSTijl Coosemans #define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
566fd839f9SAlexander Kabaev #define	__INT_MAX	0x7fffffff	/* max value for an int */
576fd839f9SAlexander Kabaev #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
585b81b6b3SRodney W. Grimes 
59911127a0STijl Coosemans #ifdef __LP64__
609858863cSTijl Coosemans #define	__ULONG_MAX	0xffffffffffffffff
619858863cSTijl Coosemans #define	__LONG_MAX	0x7fffffffffffffff
629858863cSTijl Coosemans #define	__LONG_MIN	(-0x7fffffffffffffff - 1)
63911127a0STijl Coosemans #define	__LONG_BIT	64
64780ba1bcSDavid E. O'Brien #else
656fd839f9SAlexander Kabaev #define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */
666fd839f9SAlexander Kabaev #define	__LONG_MAX	0x7fffffffL	/* max value for a long */
676fd839f9SAlexander Kabaev #define	__LONG_MIN	(-0x7fffffffL - 1)	/* min value for a long */
68911127a0STijl Coosemans #define	__LONG_BIT	32
69780ba1bcSDavid E. O'Brien #endif
70780ba1bcSDavid E. O'Brien 
716fd839f9SAlexander Kabaev #define	__ULLONG_MAX	0xffffffffffffffffULL
726fd839f9SAlexander Kabaev #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
736fd839f9SAlexander Kabaev #define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
7490d795a1SAndrew Moore 
75a56e818fSTijl Coosemans #ifdef __LP64__
76c3e289e1SNathan Whitehorn #define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
77c3e289e1SNathan Whitehorn #define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
78c3e289e1SNathan Whitehorn #else
796fd839f9SAlexander Kabaev #define	__SSIZE_MAX	__INT_MAX	/* max value for a ssize_t */
806fd839f9SAlexander Kabaev #define	__SIZE_T_MAX	__UINT_MAX	/* max value for a size_t */
81c3e289e1SNathan Whitehorn #endif
8226f9a767SRodney W. Grimes 
836fd839f9SAlexander Kabaev #define	__OFF_MAX	__LLONG_MAX	/* max value for an off_t */
846fd839f9SAlexander Kabaev #define	__OFF_MIN	__LLONG_MIN	/* min value for an off_t */
85a6314641SAndrey A. Chernov 
86780ba1bcSDavid E. O'Brien /* Quads and long longs are the same size.  Ensure they stay in sync. */
876fd839f9SAlexander Kabaev #define	__UQUAD_MAX	__ULLONG_MAX	/* max value for a uquad_t */
886fd839f9SAlexander Kabaev #define	__QUAD_MAX	__LLONG_MAX	/* max value for a quad_t */
896fd839f9SAlexander Kabaev #define	__QUAD_MIN	__LLONG_MIN	/* min value for a quad_t */
905cbdd813SPeter Grehan 
916fd839f9SAlexander Kabaev #define	__WORD_BIT	32
925cbdd813SPeter Grehan 
93a1f85d7fSStefan Farfeleder /* Minimum signal stack size. */
94a1f85d7fSStefan Farfeleder #define	__MINSIGSTKSZ	(512 * 4)
95a1f85d7fSStefan Farfeleder 
966fd839f9SAlexander Kabaev #endif /* !_MACHINE__LIMITS_H_ */
97