_limits.h revision 178172
153913Sarchie/*- 253913Sarchie * Copyright (c) 1988, 1993 353913Sarchie * The Regents of the University of California. All rights reserved. 453913Sarchie * 553913Sarchie * Redistribution and use in source and binary forms, with or without 653913Sarchie * modification, are permitted provided that the following conditions 753913Sarchie * are met: 853913Sarchie * 1. Redistributions of source code must retain the above copyright 953913Sarchie * notice, this list of conditions and the following disclaimer. 1053913Sarchie * 2. Redistributions in binary form must reproduce the above copyright 1153913Sarchie * notice, this list of conditions and the following disclaimer in the 1253913Sarchie * documentation and/or other materials provided with the distribution. 1353913Sarchie * 4. Neither the name of the University nor the names of its contributors 1453913Sarchie * may be used to endorse or promote products derived from this software 1553913Sarchie * without specific prior written permission. 1653913Sarchie * 1753913Sarchie * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1853913Sarchie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1953913Sarchie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2053913Sarchie * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2153913Sarchie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2253913Sarchie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2353913Sarchie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2453913Sarchie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2553913Sarchie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2653913Sarchie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2753913Sarchie * SUCH DAMAGE. 2853913Sarchie * 2953913Sarchie * @(#)limits.h 8.3 (Berkeley) 1/4/94 3053913Sarchie * from: src/sys/i386/include/_limits.h,v 1.27 2005/01/06 22:18:15 imp 3153913Sarchie * $FreeBSD: head/sys/mips/include/_limits.h 178172 2008-04-13 07:27:37Z imp $ 3253913Sarchie */ 3353913Sarchie 34120612Sjulian#ifndef _MACHINE__LIMITS_H_ 3553913Sarchie#define _MACHINE__LIMITS_H_ 3653913Sarchie 3753913Sarchie/* 3853913Sarchie * According to ANSI (section 2.2.4.2), the values below must be usable by 3953913Sarchie * #if preprocessing directives. Additionally, the expression must have the 4053913Sarchie * same type as would an expression that is an object of the corresponding 4153913Sarchie * type converted according to the integral promotions. The subtraction for 4253913Sarchie * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an 4353913Sarchie * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). 4453913Sarchie * These numbers are for the default configuration of gcc. They work for 4553913Sarchie * some other compilers as well, but this should not be depended on. 4653913Sarchie */ 4753913Sarchie 4853913Sarchie#define __CHAR_BIT 8 /* number of bits in a char */ 4953913Sarchie 5053913Sarchie#define __SCHAR_MAX 0x7f /* max value for a signed char */ 5153913Sarchie#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ 5253913Sarchie 5353913Sarchie#define __UCHAR_MAX 0xff /* max value for an unsigned char */ 5453913Sarchie 5553913Sarchie#define __USHRT_MAX 0xffff /* max value for an unsigned short */ 5653913Sarchie#define __SHRT_MAX 0x7fff /* max value for a short */ 5753913Sarchie#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ 5853913Sarchie 5953913Sarchie#define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ 6053913Sarchie#define __INT_MAX 0x7fffffff /* max value for an int */ 6153913Sarchie#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ 6253913Sarchie 6353913Sarchie/* Bad hack for gcc configured to give 64-bit longs. */ 6453913Sarchie#ifdef _LARGE_LONG 6553913Sarchie#define __ULONG_MAX 0xffffffffffffffffUL 6653913Sarchie#define __LONG_MAX 0x7fffffffffffffffL 6753913Sarchie#define __LONG_MIN (-0x7fffffffffffffffL - 1) 6853913Sarchie#else 6953913Sarchie#define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ 7053913Sarchie#define __LONG_MAX 0x7fffffffL /* max value for a long */ 7153913Sarchie#define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */ 7253913Sarchie#endif 7353913Sarchie 7453913Sarchie /* max value for an unsigned long long */ 7553913Sarchie#define __ULLONG_MAX 0xffffffffffffffffULL 7653913Sarchie#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ 7753913Sarchie#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ 7853913Sarchie 7953913Sarchie#define __SSIZE_MAX __INT_MAX /* max value for a ssize_t */ 8053913Sarchie 8153913Sarchie#define __SIZE_T_MAX __UINT_MAX /* max value for a size_t */ 8253913Sarchie 8353913Sarchie#define __OFF_MAX __LLONG_MAX /* max value for an off_t */ 8453913Sarchie#define __OFF_MIN __LLONG_MIN /* min value for an off_t */ 8553913Sarchie 8653913Sarchie/* Quads and long longs are the same size. Ensure they stay in sync. */ 8753913Sarchie#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ 8853913Sarchie#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ 8953913Sarchie#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ 9053913Sarchie 9153913Sarchie#ifdef _LARGE_LONG 9253913Sarchie#define __LONG_BIT 64 9353913Sarchie#else 9453913Sarchie#define __LONG_BIT 32 9553913Sarchie#endif 9653913Sarchie#define __WORD_BIT 32 9753913Sarchie 9853913Sarchie#define __MINSIGSTKSZ (512 * 4) 9953913Sarchie 10053913Sarchie#endif /* !_MACHINE__LIMITS_H_ */ 10153913Sarchie