15b81b6b3SRodney W. Grimes /* 226f9a767SRodney W. Grimes * Copyright (c) 1988, 1993 326f9a767SRodney W. Grimes * The Regents of the University of California. All rights reserved. 45b81b6b3SRodney W. Grimes * 55b81b6b3SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 65b81b6b3SRodney W. Grimes * modification, are permitted provided that the following conditions 75b81b6b3SRodney W. Grimes * are met: 85b81b6b3SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 95b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 105b81b6b3SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 115b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 125b81b6b3SRodney W. Grimes * documentation and/or other materials provided with the distribution. 135b81b6b3SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 145b81b6b3SRodney W. Grimes * must display the following acknowledgement: 155b81b6b3SRodney W. Grimes * This product includes software developed by the University of 165b81b6b3SRodney W. Grimes * California, Berkeley and its contributors. 175b81b6b3SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 185b81b6b3SRodney W. Grimes * may be used to endorse or promote products derived from this software 195b81b6b3SRodney W. Grimes * without specific prior written permission. 205b81b6b3SRodney W. Grimes * 215b81b6b3SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 225b81b6b3SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 235b81b6b3SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 245b81b6b3SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 255b81b6b3SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 265b81b6b3SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 275b81b6b3SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 285b81b6b3SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 295b81b6b3SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 305b81b6b3SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 315b81b6b3SRodney W. Grimes * SUCH DAMAGE. 325b81b6b3SRodney W. Grimes * 3326f9a767SRodney W. Grimes * @(#)limits.h 8.3 (Berkeley) 1/4/94 34c3aac50fSPeter Wemm * $FreeBSD$ 355b81b6b3SRodney W. Grimes */ 365b81b6b3SRodney W. Grimes 376fd839f9SAlexander Kabaev #ifndef _MACHINE__LIMITS_H_ 386fd839f9SAlexander Kabaev #define _MACHINE__LIMITS_H_ 396e393973SGarrett Wollman 406fd839f9SAlexander Kabaev #define __CHAR_BIT 8 /* number of bits in a char */ 415b81b6b3SRodney W. Grimes 426fd839f9SAlexander Kabaev #define __SCHAR_MAX 0x7f /* max value for a signed char */ 436fd839f9SAlexander Kabaev #define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ 4426f9a767SRodney W. Grimes 456fd839f9SAlexander Kabaev #define __UCHAR_MAX 0xff /* max value for an unsigned char */ 4680a29084SAndrey A. Chernov 476fd839f9SAlexander Kabaev #define __USHRT_MAX 0xffff /* max value for an unsigned short */ 486fd839f9SAlexander Kabaev #define __SHRT_MAX 0x7fff /* max value for a short */ 496fd839f9SAlexander Kabaev #define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ 5026f9a767SRodney W. Grimes 516fd839f9SAlexander Kabaev #define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ 526fd839f9SAlexander Kabaev #define __INT_MAX 0x7fffffff /* max value for an int */ 536fd839f9SAlexander Kabaev #define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ 545b81b6b3SRodney W. Grimes 55780ba1bcSDavid E. O'Brien /* Bad hack for gcc configured to give 64-bit longs. */ 56780ba1bcSDavid E. O'Brien #ifdef _LARGE_LONG 576fd839f9SAlexander Kabaev #define __ULONG_MAX 0xffffffffffffffffUL 586fd839f9SAlexander Kabaev #define __LONG_MAX 0x7fffffffffffffffL 596fd839f9SAlexander Kabaev #define __LONG_MIN (-0x7fffffffffffffffL - 1) 60780ba1bcSDavid E. O'Brien #else 616fd839f9SAlexander Kabaev #define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ 626fd839f9SAlexander Kabaev #define __LONG_MAX 0x7fffffffL /* max value for a long */ 636fd839f9SAlexander Kabaev #define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */ 64780ba1bcSDavid E. O'Brien #endif 65780ba1bcSDavid E. O'Brien 666fd839f9SAlexander Kabaev #define __ULLONG_MAX 0xffffffffffffffffULL 676fd839f9SAlexander Kabaev #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ 686fd839f9SAlexander Kabaev #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ 6990d795a1SAndrew Moore 706fd839f9SAlexander Kabaev #define __SSIZE_MAX __INT_MAX /* max value for a ssize_t */ 7126f9a767SRodney W. Grimes 726fd839f9SAlexander Kabaev #define __SIZE_T_MAX __UINT_MAX /* max value for a size_t */ 7326f9a767SRodney W. Grimes 746fd839f9SAlexander Kabaev #define __OFF_MAX __LLONG_MAX /* max value for an off_t */ 756fd839f9SAlexander Kabaev #define __OFF_MIN __LLONG_MIN /* min value for an off_t */ 76a6314641SAndrey A. Chernov 77780ba1bcSDavid E. O'Brien /* Quads and long longs are the same size. Ensure they stay in sync. */ 786fd839f9SAlexander Kabaev #define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ 796fd839f9SAlexander Kabaev #define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ 806fd839f9SAlexander Kabaev #define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ 815cbdd813SPeter Grehan 826fd839f9SAlexander Kabaev #ifdef _LARGE_LONG 836fd839f9SAlexander Kabaev #define __LONG_BIT 64 846fd839f9SAlexander Kabaev #else 856fd839f9SAlexander Kabaev #define __LONG_BIT 32 866fd839f9SAlexander Kabaev #endif 876fd839f9SAlexander Kabaev #define __WORD_BIT 32 885cbdd813SPeter Grehan 896fd839f9SAlexander Kabaev #define __DBL_DIG 15 906fd839f9SAlexander Kabaev #define __DBL_MAX 1.7976931348623157E+308 916fd839f9SAlexander Kabaev #define __DBL_MIN 2.2250738585072014E-308 9290d795a1SAndrew Moore 936fd839f9SAlexander Kabaev #define __FLT_DIG 6 946fd839f9SAlexander Kabaev #define __FLT_MAX 3.40282347E+38F 956fd839f9SAlexander Kabaev #define __FLT_MIN 1.17549435E-38F 966fd839f9SAlexander Kabaev 976fd839f9SAlexander Kabaev #endif /* !_MACHINE__LIMITS_H_ */ 98