_limits.h revision 114678
14Srgrimes/* 21549Srgrimes * Copyright (c) 1988, 1993 31549Srgrimes * The Regents of the University of California. All rights reserved. 44Srgrimes * 54Srgrimes * Redistribution and use in source and binary forms, with or without 64Srgrimes * modification, are permitted provided that the following conditions 74Srgrimes * are met: 84Srgrimes * 1. Redistributions of source code must retain the above copyright 94Srgrimes * notice, this list of conditions and the following disclaimer. 104Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 114Srgrimes * notice, this list of conditions and the following disclaimer in the 124Srgrimes * documentation and/or other materials provided with the distribution. 134Srgrimes * 3. All advertising materials mentioning features or use of this software 144Srgrimes * must display the following acknowledgement: 154Srgrimes * This product includes software developed by the University of 164Srgrimes * California, Berkeley and its contributors. 174Srgrimes * 4. Neither the name of the University nor the names of its contributors 184Srgrimes * may be used to endorse or promote products derived from this software 194Srgrimes * without specific prior written permission. 204Srgrimes * 214Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 224Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 234Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 244Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 254Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 264Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 274Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 284Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 294Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 304Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 314Srgrimes * SUCH DAMAGE. 324Srgrimes * 331549Srgrimes * @(#)limits.h 8.3 (Berkeley) 1/4/94 3450477Speter * $FreeBSD: head/sys/i386/include/_limits.h 114678 2003-05-04 22:13:04Z kan $ 354Srgrimes */ 364Srgrimes 37113941Skan#ifndef _MACHINE__LIMITS_H_ 38113941Skan#define _MACHINE__LIMITS_H_ 39719Swollman 40113941Skan#define __CHAR_BIT 8 /* number of bits in a char */ 414Srgrimes 42114678Skan/* 43114678Skan * According to ANSI (section 2.2.4.2), the values below must be usable by 44114678Skan * #if preprocessing directives. Additionally, the expression must have the 45114678Skan * same type as would an expression that is an object of the corresponding 46114678Skan * type converted according to the integral promotions. The subtraction for 47114678Skan * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an 48114678Skan * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). 49114678Skan * These numbers are for the default configuration of gcc. They work for 50114678Skan * some other compilers as well, but this should not be depended on. 51114678Skan */ 52114678Skan 53113941Skan#define __SCHAR_MAX 0x7f /* max value for a signed char */ 54113941Skan#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ 554Srgrimes 56113941Skan#define __UCHAR_MAX 0xff /* max value for an unsigned char */ 571549Srgrimes 58113941Skan#define __USHRT_MAX 0xffff /* max value for an unsigned short */ 59113941Skan#define __SHRT_MAX 0x7fff /* max value for a short */ 60113941Skan#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ 6147347Sache 62113941Skan#define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ 63113941Skan#define __INT_MAX 0x7fffffff /* max value for an int */ 64113941Skan#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ 651549Srgrimes 6667487Sobrien/* Bad hack for gcc configured to give 64-bit longs. */ 6767487Sobrien#ifdef _LARGE_LONG 68113941Skan#define __ULONG_MAX 0xffffffffffffffffUL 69113941Skan#define __LONG_MAX 0x7fffffffffffffffL 70113941Skan#define __LONG_MIN (-0x7fffffffffffffffL - 1) 7167487Sobrien#else 72113941Skan#define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ 73113941Skan#define __LONG_MAX 0x7fffffffL /* max value for a long */ 74113941Skan#define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */ 7567487Sobrien#endif 76880Salm 7767487Sobrien /* max value for an unsigned long long */ 78113941Skan#define __ULLONG_MAX 0xffffffffffffffffULL 79113941Skan#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ 80113941Skan#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ 8167487Sobrien 82113941Skan#define __SSIZE_MAX __INT_MAX /* max value for a ssize_t */ 83880Salm 84113941Skan#define __SIZE_T_MAX __UINT_MAX /* max value for a size_t */ 851549Srgrimes 86113941Skan#define __OFF_MAX __LLONG_MAX /* max value for an off_t */ 87113941Skan#define __OFF_MIN __LLONG_MIN /* min value for an off_t */ 8881718Sache 8967487Sobrien/* Quads and long longs are the same size. Ensure they stay in sync. */ 90113941Skan#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ 91113941Skan#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ 92113941Skan#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ 931549Srgrimes 94113941Skan#ifdef _LARGE_LONG 95113941Skan#define __LONG_BIT 64 96113941Skan#else 97113941Skan#define __LONG_BIT 32 98113941Skan#endif 99113941Skan#define __WORD_BIT 32 100113941Skan 101113941Skan#endif /* !_MACHINE__LIMITS_H_ */ 102