1178172Simp/*-
2178172Simp * Copyright (c) 1988, 1993
3178172Simp *	The Regents of the University of California.  All rights reserved.
4178172Simp *
5178172Simp * Redistribution and use in source and binary forms, with or without
6178172Simp * modification, are permitted provided that the following conditions
7178172Simp * are met:
8178172Simp * 1. Redistributions of source code must retain the above copyright
9178172Simp *    notice, this list of conditions and the following disclaimer.
10178172Simp * 2. Redistributions in binary form must reproduce the above copyright
11178172Simp *    notice, this list of conditions and the following disclaimer in the
12178172Simp *    documentation and/or other materials provided with the distribution.
13178172Simp * 4. Neither the name of the University nor the names of its contributors
14178172Simp *    may be used to endorse or promote products derived from this software
15178172Simp *    without specific prior written permission.
16178172Simp *
17178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20178172Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27178172Simp * SUCH DAMAGE.
28178172Simp *
29178172Simp *	@(#)limits.h	8.3 (Berkeley) 1/4/94
30178172Simp *	from: src/sys/i386/include/_limits.h,v 1.27 2005/01/06 22:18:15 imp
31178172Simp * $FreeBSD$
32178172Simp */
33178172Simp
34178172Simp#ifndef _MACHINE__LIMITS_H_
35178172Simp#define	_MACHINE__LIMITS_H_
36178172Simp
37178172Simp/*
38178172Simp * According to ANSI (section 2.2.4.2), the values below must be usable by
39178172Simp * #if preprocessing directives.  Additionally, the expression must have the
40178172Simp * same type as would an expression that is an object of the corresponding
41178172Simp * type converted according to the integral promotions.  The subtraction for
42178172Simp * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
43178172Simp * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
44178172Simp */
45178172Simp
46178172Simp#define	__CHAR_BIT	8		/* number of bits in a char */
47178172Simp
48178172Simp#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
49178172Simp#define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
50178172Simp
51178172Simp#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
52178172Simp
53178172Simp#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
54178172Simp#define	__SHRT_MAX	0x7fff		/* max value for a short */
55178172Simp#define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
56178172Simp
57217145Stijl#define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */
58178172Simp#define	__INT_MAX	0x7fffffff	/* max value for an int */
59178172Simp#define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
60178172Simp
61218266Stijl#ifdef __mips_n64
62217145Stijl#define	__ULONG_MAX	0xffffffffffffffff
63217145Stijl#define	__LONG_MAX	0x7fffffffffffffff
64217145Stijl#define	__LONG_MIN	(-0x7fffffffffffffff - 1)
65217128Stijl#define	__LONG_BIT	64
66178172Simp#else
67178172Simp#define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */
68178172Simp#define	__LONG_MAX	0x7fffffffL	/* max value for a long */
69178172Simp#define	__LONG_MIN	(-0x7fffffffL - 1)	/* min value for a long */
70217128Stijl#define	__LONG_BIT	32
71178172Simp#endif
72178172Simp
73178172Simp			/* max value for an unsigned long long */
74178172Simp#define	__ULLONG_MAX	0xffffffffffffffffULL
75178172Simp#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
76178172Simp#define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
77178172Simp
78206715Sjmallett#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
79178172Simp
80206715Sjmallett#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
81178172Simp
82178172Simp#define	__OFF_MAX	__LLONG_MAX	/* max value for an off_t */
83178172Simp#define	__OFF_MIN	__LLONG_MIN	/* min value for an off_t */
84178172Simp
85178172Simp/* Quads and long longs are the same size.  Ensure they stay in sync. */
86178172Simp#define	__UQUAD_MAX	__ULLONG_MAX	/* max value for a uquad_t */
87178172Simp#define	__QUAD_MAX	__LLONG_MAX	/* max value for a quad_t */
88178172Simp#define	__QUAD_MIN	__LLONG_MIN	/* min value for a quad_t */
89178172Simp
90178172Simp#define	__WORD_BIT	32
91178172Simp
92178172Simp#define __MINSIGSTKSZ     (512 * 4)
93178172Simp
94178172Simp#endif /* !_MACHINE__LIMITS_H_ */
95