_limits.h revision 139825
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: head/sys/sparc64/include/_limits.h 139825 2005-01-07 02:29:27Z imp $
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 * These numbers are for the default configuration of gcc.  They work for
41114678Skan * some other compilers as well, but this should not be depended on.
42114678Skan */
43114678Skan
44115164Skan#define	__CHAR_BIT	8		/* number of bits in a char */
45115164Skan
46113941Skan#define	__SCHAR_MAX	0x7f		/* max value for a signed char */
47113941Skan#define	__SCHAR_MIN	(-0x7f-1)	/* min value for a signed char */
4880708Sjake
49113941Skan#define	__UCHAR_MAX	0xffU		/* max value for an unsigned char */
5080708Sjake
51113941Skan#define	__USHRT_MAX	0xffffU		/* max value for an unsigned short */
52113941Skan#define	__SHRT_MAX	0x7fff		/* max value for a short */
53113941Skan#define	__SHRT_MIN	(-0x7fff-1)	/* min value for a short */
5480708Sjake
55113941Skan#define	__UINT_MAX	0xffffffffU	/* max value for an unsigned int */
56113941Skan#define	__INT_MAX	0x7fffffff	/* max value for an int */
57113941Skan#define	__INT_MIN	(-0x7fffffff-1)	/* min value for an int */
5880708Sjake
59113941Skan#define	__ULONG_MAX	0xffffffffffffffffUL	/* max for an unsigned long */
60113941Skan#define	__LONG_MAX	0x7fffffffffffffffL	/* max for a long */
61113941Skan#define	__LONG_MIN	(-0x7fffffffffffffffL-1) /* min for a long */
6280708Sjake
63113941Skan/* Long longs and longs are the same size on sparc64. */
6480708Sjake					/* max for an unsigned long long */
65113941Skan#define	__ULLONG_MAX	0xffffffffffffffffULL
66113941Skan#define	__LLONG_MAX	0x7fffffffffffffffLL	/* max for a long long */
67113941Skan#define	__LLONG_MIN	(-0x7fffffffffffffffLL-1) /* min for a long long */
6880708Sjake
69113941Skan#define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */
7080708Sjake
71113941Skan#define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */
7280708Sjake
73113941Skan#define	__OFF_MAX	__LONG_MAX	/* max value for an off_t */
74113941Skan#define	__OFF_MIN	__LONG_MIN	/* min value for an off_t */
7581720Sache
7680708Sjake/* Quads and longs are the same on the alpha.  Ensure they stay in sync. */
77113941Skan#define	__UQUAD_MAX	(__ULONG_MAX)	/* max value for a uquad_t */
78113941Skan#define	__QUAD_MAX	(__LONG_MAX)	/* max value for a quad_t */
79113941Skan#define	__QUAD_MIN	(__LONG_MIN)	/* min value for a quad_t */
8080708Sjake
81113941Skan#define	__LONG_BIT	64
82113941Skan#define	__WORD_BIT	32
8380708Sjake
84113941Skan#endif /* !_MACHINE__LIMITS_H_ */
85