146280ae7SWarner Losh /*- 2ea9ea04cSDavid E. O'Brien * Copyright (c) 1988, 1993 3ea9ea04cSDavid E. O'Brien * The Regents of the University of California. All rights reserved. 4ea9ea04cSDavid E. O'Brien * 5ea9ea04cSDavid E. O'Brien * Redistribution and use in source and binary forms, with or without 6ea9ea04cSDavid E. O'Brien * modification, are permitted provided that the following conditions 7ea9ea04cSDavid E. O'Brien * are met: 8ea9ea04cSDavid E. O'Brien * 1. Redistributions of source code must retain the above copyright 9ea9ea04cSDavid E. O'Brien * notice, this list of conditions and the following disclaimer. 10ea9ea04cSDavid E. O'Brien * 2. Redistributions in binary form must reproduce the above copyright 11ea9ea04cSDavid E. O'Brien * notice, this list of conditions and the following disclaimer in the 12ea9ea04cSDavid E. O'Brien * documentation and/or other materials provided with the distribution. 13ea9ea04cSDavid E. O'Brien * 4. Neither the name of the University nor the names of its contributors 14ea9ea04cSDavid E. O'Brien * may be used to endorse or promote products derived from this software 15ea9ea04cSDavid E. O'Brien * without specific prior written permission. 16ea9ea04cSDavid E. O'Brien * 17ea9ea04cSDavid E. O'Brien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18ea9ea04cSDavid E. O'Brien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19ea9ea04cSDavid E. O'Brien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20ea9ea04cSDavid E. O'Brien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21ea9ea04cSDavid E. O'Brien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22ea9ea04cSDavid E. O'Brien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23ea9ea04cSDavid E. O'Brien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24ea9ea04cSDavid E. O'Brien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25ea9ea04cSDavid E. O'Brien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26ea9ea04cSDavid E. O'Brien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27ea9ea04cSDavid E. O'Brien * SUCH DAMAGE. 28ea9ea04cSDavid E. O'Brien * 29ea9ea04cSDavid E. O'Brien * @(#)limits.h 8.3 (Berkeley) 1/4/94 30ea9ea04cSDavid E. O'Brien * $FreeBSD$ 31ea9ea04cSDavid E. O'Brien */ 32ea9ea04cSDavid E. O'Brien 336fd839f9SAlexander Kabaev #ifndef _MACHINE__LIMITS_H_ 346fd839f9SAlexander Kabaev #define _MACHINE__LIMITS_H_ 35ea9ea04cSDavid E. O'Brien 360eda4c08SAlexander Kabaev /* 370eda4c08SAlexander Kabaev * According to ANSI (section 2.2.4.2), the values below must be usable by 380eda4c08SAlexander Kabaev * #if preprocessing directives. Additionally, the expression must have the 390eda4c08SAlexander Kabaev * same type as would an expression that is an object of the corresponding 400eda4c08SAlexander Kabaev * type converted according to the integral promotions. The subtraction for 410eda4c08SAlexander Kabaev * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an 420eda4c08SAlexander Kabaev * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). 430eda4c08SAlexander Kabaev * These numbers are for the default configuration of gcc. They work for 440eda4c08SAlexander Kabaev * some other compilers as well, but this should not be depended on. 450eda4c08SAlexander Kabaev */ 460eda4c08SAlexander Kabaev 47980ded9aSAlexander Kabaev #define __CHAR_BIT 8 /* number of bits in a char */ 48980ded9aSAlexander Kabaev 496fd839f9SAlexander Kabaev #define __SCHAR_MAX 0x7f /* max value for a signed char */ 506fd839f9SAlexander Kabaev #define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ 51ea9ea04cSDavid E. O'Brien 526fd839f9SAlexander Kabaev #define __UCHAR_MAX 0xffU /* max value for an unsigned char */ 53ea9ea04cSDavid E. O'Brien 546fd839f9SAlexander Kabaev #define __USHRT_MAX 0xffffU /* max value for an unsigned short */ 556fd839f9SAlexander Kabaev #define __SHRT_MAX 0x7fff /* max value for a short */ 566fd839f9SAlexander Kabaev #define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ 57ea9ea04cSDavid E. O'Brien 586fd839f9SAlexander Kabaev #define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ 596fd839f9SAlexander Kabaev #define __INT_MAX 0x7fffffff /* max value for an int */ 606fd839f9SAlexander Kabaev #define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ 61ea9ea04cSDavid E. O'Brien 626fd839f9SAlexander Kabaev #define __ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */ 636fd839f9SAlexander Kabaev #define __LONG_MAX 0x7fffffffffffffffL /* max for a long */ 646fd839f9SAlexander Kabaev #define __LONG_MIN (-0x7fffffffffffffffL - 1) /* min for a long */ 65ea9ea04cSDavid E. O'Brien 66cda07865SPeter Wemm /* max value for an unsigned long long */ 676fd839f9SAlexander Kabaev #define __ULLONG_MAX 0xffffffffffffffffULL 68cda07865SPeter Wemm #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ 696fd839f9SAlexander Kabaev #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ 70ea9ea04cSDavid E. O'Brien 716fd839f9SAlexander Kabaev #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ 72ea9ea04cSDavid E. O'Brien 736fd839f9SAlexander Kabaev #define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ 74ea9ea04cSDavid E. O'Brien 756fd839f9SAlexander Kabaev #define __OFF_MAX __LONG_MAX /* max value for an off_t */ 766fd839f9SAlexander Kabaev #define __OFF_MIN __LONG_MIN /* min value for an off_t */ 77ea9ea04cSDavid E. O'Brien 786fd839f9SAlexander Kabaev /* Quads and longs are the same on the amd64. Ensure they stay in sync. */ 79cda07865SPeter Wemm #define __UQUAD_MAX __ULONG_MAX /* max value for a uquad_t */ 80cda07865SPeter Wemm #define __QUAD_MAX __LONG_MAX /* max value for a quad_t */ 81cda07865SPeter Wemm #define __QUAD_MIN __LONG_MIN /* min value for a quad_t */ 82ea9ea04cSDavid E. O'Brien 836fd839f9SAlexander Kabaev #define __LONG_BIT 64 846fd839f9SAlexander Kabaev #define __WORD_BIT 32 85ea9ea04cSDavid E. O'Brien 866fd839f9SAlexander Kabaev #endif /* !_MACHINE__LIMITS_H_ */ 87