limits.h revision 80708
180708Sjake/* 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 80708 2001-07-31 05:45:16Z jake $ 2880708Sjake */ 2980708Sjake 3080708Sjake#ifndef _MACHINE_LIMITS_H_ 3180708Sjake#define _MACHINE_LIMITS_H_ 3280708Sjake 3380708Sjake#define CHAR_BIT 8 /* number of bits in a char */ 3480708Sjake#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ 3580708Sjake 3680708Sjake/* 3780708Sjake * According to ANSI (section 2.2.4.2), the values below must be usable by 3880708Sjake * #if preprocessing directives. Additionally, the expression must have the 3980708Sjake * same type as would an expression that is an object of the corresponding 4080708Sjake * type converted according to the integral promotions. The subtraction for 4180708Sjake * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an 4280708Sjake * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). 4380708Sjake * These numbers are for the default configuration of gcc. They work for 4480708Sjake * some other compilers as well, but this should not be depended on. 4580708Sjake */ 4680708Sjake#define SCHAR_MAX 0x7f /* max value for a signed char */ 4780708Sjake#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */ 4880708Sjake 4980708Sjake#define UCHAR_MAX 0xffU /* max value for an unsigned char */ 5080708Sjake#define CHAR_MAX 0x7f /* max value for a char */ 5180708Sjake#define CHAR_MIN (-0x7f-1) /* min value for a char */ 5280708Sjake 5380708Sjake#define USHRT_MAX 0xffffU /* max value for an unsigned short */ 5480708Sjake#define SHRT_MAX 0x7fff /* max value for a short */ 5580708Sjake#define SHRT_MIN (-0x7fff-1) /* min value for a short */ 5680708Sjake 5780708Sjake#define UINT_MAX 0xffffffffU /* max value for an unsigned int */ 5880708Sjake#define INT_MAX 0x7fffffff /* max value for an int */ 5980708Sjake#define INT_MIN (-0x7fffffff-1) /* min value for an int */ 6080708Sjake 6180708Sjake#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */ 6280708Sjake#define LONG_MAX 0x7fffffffffffffffL /* max for a long */ 6380708Sjake#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */ 6480708Sjake 6580708Sjake/* Long longs and longs are the same size on the alpha. */ 6680708Sjake /* max for an unsigned long long */ 6780708Sjake#define ULLONG_MAX 0xffffffffffffffffULL 6880708Sjake#define LLONG_MAX 0x7fffffffffffffffLL /* max for a long long */ 6980708Sjake#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min for a long long */ 7080708Sjake 7180708Sjake#if !defined(_ANSI_SOURCE) 7280708Sjake#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ 7380708Sjake 7480708Sjake#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) 7580708Sjake#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */ 7680708Sjake 7780708Sjake/* Quads and longs are the same on the alpha. Ensure they stay in sync. */ 7880708Sjake#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */ 7980708Sjake#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */ 8080708Sjake#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */ 8180708Sjake 8280708Sjake#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */ 8380708Sjake#endif /* !_ANSI_SOURCE */ 8480708Sjake 8580708Sjake#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE) 8680708Sjake#define LONG_BIT 64 8780708Sjake#define WORD_BIT 32 8880708Sjake 8980708Sjake#define DBL_DIG 15 9080708Sjake#define DBL_MAX 1.7976931348623157E+308 9180708Sjake#define DBL_MIN 2.2250738585072014E-308 9280708Sjake 9380708Sjake#define FLT_DIG 6 9480708Sjake#define FLT_MAX 3.40282347E+38F 9580708Sjake#define FLT_MIN 1.17549435E-38F 9680708Sjake#endif 9780708Sjake 9880708Sjake#endif /* !_MACHINE_LIMITS_H_ */ 99