1139825Simp/*-
280708Sjake * Copyright (c) 1988, 1993
380708Sjake *	The Regents of the University of California.  All rights reserved.
480708Sjake *
580708Sjake * Redistribution and use in source and binary forms, with or without
680708Sjake * modification, are permitted provided that the following conditions
780708Sjake * are met:
880708Sjake * 1. Redistributions of source code must retain the above copyright
980708Sjake *    notice, this list of conditions and the following disclaimer.
1080708Sjake * 2. Redistributions in binary form must reproduce the above copyright
1180708Sjake *    notice, this list of conditions and the following disclaimer in the
1280708Sjake *    documentation and/or other materials provided with the distribution.
1380708Sjake *
1480708Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1580708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1680708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1780708Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1880708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1980708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2080708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2180708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2280708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2380708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2480708Sjake * SUCH DAMAGE.
2580708Sjake *
2680708Sjake *	@(#)limits.h	8.3 (Berkeley) 1/4/94
2780708Sjake * $FreeBSD$
2880708Sjake */
2980708Sjake
30113941Skan#ifndef	_MACHINE__LIMITS_H_
31113941Skan#define	_MACHINE__LIMITS_H_
3280708Sjake
33114678Skan/*
34114678Skan * According to ANSI (section 2.2.4.2), the values below must be usable by
35114678Skan * #if preprocessing directives.  Additionally, the expression must have the
36114678Skan * same type as would an expression that is an object of the corresponding
37114678Skan * type converted according to the integral promotions.  The subtraction for
38114678Skan * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
39114678Skan * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
40114678Skan */
41114678Skan
42115164Skan#define	__CHAR_BIT	8		/* number of bits in a char */
43115164Skan
44113941Skan#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
45113941Skan#define	__SCHAR_MIN	(-0x7f-1)	/* min value for a signed char */
4680708Sjake
47217145Stijl#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
4880708Sjake
49217145Stijl#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
50113941Skan#define	__SHRT_MAX	0x7fff		/* max value for a short */
51113941Skan#define	__SHRT_MIN	(-0x7fff-1)	/* min value for a short */
5280708Sjake
53217145Stijl#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
54113941Skan#define	__INT_MAX	0x7fffffff	/* max value for an int */
55113941Skan#define	__INT_MIN	(-0x7fffffff-1)	/* min value for an int */
5680708Sjake
57217145Stijl#define	__ULONG_MAX	0xffffffffffffffff	/* max for an unsigned long */
58217145Stijl#define	__LONG_MAX	0x7fffffffffffffff	/* max for a long */
59217145Stijl#define	__LONG_MIN	(-0x7fffffffffffffff-1) /* min for a long */
6080708Sjake
61217145Stijl/* Long longs have the same size but not the same type as longs. */
6280708Sjake					/* max for an unsigned long long */
63113941Skan#define	__ULLONG_MAX	0xffffffffffffffffULL
64113941Skan#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max for a long long */
65113941Skan#define	__LLONG_MIN	(-0x7fffffffffffffffLL-1) /* min for a long long */
6680708Sjake
67113941Skan#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
6880708Sjake
69113941Skan#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
7080708Sjake
71113941Skan#define	__OFF_MAX	__LONG_MAX	/* max value for an off_t */
72113941Skan#define	__OFF_MIN	__LONG_MIN	/* min value for an off_t */
7381720Sache
74149327Sstefanf/* Quads and longs are the same size.  Ensure they stay in sync. */
75113941Skan#define	__UQUAD_MAX	(__ULONG_MAX)	/* max value for a uquad_t */
76113941Skan#define	__QUAD_MAX	(__LONG_MAX)	/* max value for a quad_t */
77113941Skan#define	__QUAD_MIN	(__LONG_MIN)	/* min value for a quad_t */
7880708Sjake
79113941Skan#define	__LONG_BIT	64
80113941Skan#define	__WORD_BIT	32
8180708Sjake
82149337Sstefanf/* Minimum signal stack size. */
83149337Sstefanf#define	__MINSIGSTKSZ	(1024 * 4)
84149337Sstefanf
85113941Skan#endif /* !_MACHINE__LIMITS_H_ */
86