_limits.h revision 206715
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: head/sys/mips/include/_limits.h 206715 2010-04-16 23:54:56Z jmallett $
32178172Simp */
33178172Simp
34178172Simp#ifndef _MACHINE__LIMITS_H_
35178172Simp#define	_MACHINE__LIMITS_H_
36178172Simp
37206715Sjmallett#if _MIPS_SZLONG == 64
38206715Sjmallett#define	_LARGE_LONG
39206715Sjmallett#endif
40206715Sjmallett
41178172Simp/*
42178172Simp * According to ANSI (section 2.2.4.2), the values below must be usable by
43178172Simp * #if preprocessing directives.  Additionally, the expression must have the
44178172Simp * same type as would an expression that is an object of the corresponding
45178172Simp * type converted according to the integral promotions.  The subtraction for
46178172Simp * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an
47178172Simp * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
48178172Simp * These numbers are for the default configuration of gcc.  They work for
49178172Simp * some other compilers as well, but this should not be depended on.
50178172Simp */
51178172Simp
52178172Simp#define	__CHAR_BIT	8		/* number of bits in a char */
53178172Simp
54178172Simp#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
55178172Simp#define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */
56178172Simp
57178172Simp#define	__UCHAR_MAX	0xff		/* max value for an unsigned char */
58178172Simp
59178172Simp#define	__USHRT_MAX	0xffff		/* max value for an unsigned short */
60178172Simp#define	__SHRT_MAX	0x7fff		/* max value for a short */
61178172Simp#define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */
62178172Simp
63178172Simp#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
64178172Simp#define	__INT_MAX	0x7fffffff	/* max value for an int */
65178172Simp#define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */
66178172Simp
67178172Simp/* Bad hack for gcc configured to give 64-bit longs. */
68178172Simp#ifdef _LARGE_LONG
69178172Simp#define	__ULONG_MAX	0xffffffffffffffffUL
70178172Simp#define	__LONG_MAX	0x7fffffffffffffffL
71178172Simp#define	__LONG_MIN	(-0x7fffffffffffffffL - 1)
72178172Simp#else
73178172Simp#define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */
74178172Simp#define	__LONG_MAX	0x7fffffffL	/* max value for a long */
75178172Simp#define	__LONG_MIN	(-0x7fffffffL - 1)	/* min value for a long */
76178172Simp#endif
77178172Simp
78178172Simp			/* max value for an unsigned long long */
79178172Simp#define	__ULLONG_MAX	0xffffffffffffffffULL
80178172Simp#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */
81178172Simp#define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1)  /* min for a long long */
82178172Simp
83206715Sjmallett#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
84178172Simp
85206715Sjmallett#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
86178172Simp
87178172Simp#define	__OFF_MAX	__LLONG_MAX	/* max value for an off_t */
88178172Simp#define	__OFF_MIN	__LLONG_MIN	/* min value for an off_t */
89178172Simp
90178172Simp/* Quads and long longs are the same size.  Ensure they stay in sync. */
91178172Simp#define	__UQUAD_MAX	__ULLONG_MAX	/* max value for a uquad_t */
92178172Simp#define	__QUAD_MAX	__LLONG_MAX	/* max value for a quad_t */
93178172Simp#define	__QUAD_MIN	__LLONG_MIN	/* min value for a quad_t */
94178172Simp
95178172Simp#ifdef _LARGE_LONG
96178172Simp#define	__LONG_BIT	64
97178172Simp#else
98178172Simp#define	__LONG_BIT	32
99178172Simp#endif
100178172Simp#define	__WORD_BIT	32
101178172Simp
102178172Simp#define __MINSIGSTKSZ     (512 * 4)
103178172Simp
104178172Simp#endif /* !_MACHINE__LIMITS_H_ */
105