_limits.h revision 217128
1178172Simp/*- 2178172Simp * Copyright (c) 1988, 1993 3178172Simp * The Regents of the University of California. All rights reserved. 4178172Simp * 5178172Simp * Redistribution and use in source and binary forms, with or without 6178172Simp * modification, are permitted provided that the following conditions 7178172Simp * are met: 8178172Simp * 1. Redistributions of source code must retain the above copyright 9178172Simp * notice, this list of conditions and the following disclaimer. 10178172Simp * 2. Redistributions in binary form must reproduce the above copyright 11178172Simp * notice, this list of conditions and the following disclaimer in the 12178172Simp * documentation and/or other materials provided with the distribution. 13178172Simp * 4. Neither the name of the University nor the names of its contributors 14178172Simp * may be used to endorse or promote products derived from this software 15178172Simp * without specific prior written permission. 16178172Simp * 17178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27178172Simp * SUCH DAMAGE. 28178172Simp * 29178172Simp * @(#)limits.h 8.3 (Berkeley) 1/4/94 30178172Simp * from: src/sys/i386/include/_limits.h,v 1.27 2005/01/06 22:18:15 imp 31178172Simp * $FreeBSD: head/sys/mips/include/_limits.h 217128 2011-01-07 22:57:31Z tijl $ 32178172Simp */ 33178172Simp 34178172Simp#ifndef _MACHINE__LIMITS_H_ 35178172Simp#define _MACHINE__LIMITS_H_ 36178172Simp 37178172Simp/* 38178172Simp * According to ANSI (section 2.2.4.2), the values below must be usable by 39178172Simp * #if preprocessing directives. Additionally, the expression must have the 40178172Simp * same type as would an expression that is an object of the corresponding 41178172Simp * type converted according to the integral promotions. The subtraction for 42178172Simp * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an 43178172Simp * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). 44178172Simp * These numbers are for the default configuration of gcc. They work for 45178172Simp * some other compilers as well, but this should not be depended on. 46178172Simp */ 47178172Simp 48178172Simp#define __CHAR_BIT 8 /* number of bits in a char */ 49178172Simp 50178172Simp#define __SCHAR_MAX 0x7f /* max value for a signed char */ 51178172Simp#define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ 52178172Simp 53178172Simp#define __UCHAR_MAX 0xff /* max value for an unsigned char */ 54178172Simp 55178172Simp#define __USHRT_MAX 0xffff /* max value for an unsigned short */ 56178172Simp#define __SHRT_MAX 0x7fff /* max value for a short */ 57178172Simp#define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ 58178172Simp 59178172Simp#define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ 60178172Simp#define __INT_MAX 0x7fffffff /* max value for an int */ 61178172Simp#define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ 62178172Simp 63217128Stijl#ifdef __LP64__ 64178172Simp#define __ULONG_MAX 0xffffffffffffffffUL 65178172Simp#define __LONG_MAX 0x7fffffffffffffffL 66178172Simp#define __LONG_MIN (-0x7fffffffffffffffL - 1) 67217128Stijl#define __LONG_BIT 64 68178172Simp#else 69178172Simp#define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ 70178172Simp#define __LONG_MAX 0x7fffffffL /* max value for a long */ 71178172Simp#define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */ 72217128Stijl#define __LONG_BIT 32 73178172Simp#endif 74178172Simp 75178172Simp /* max value for an unsigned long long */ 76178172Simp#define __ULLONG_MAX 0xffffffffffffffffULL 77178172Simp#define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ 78178172Simp#define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ 79178172Simp 80206715Sjmallett#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ 81178172Simp 82206715Sjmallett#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ 83178172Simp 84178172Simp#define __OFF_MAX __LLONG_MAX /* max value for an off_t */ 85178172Simp#define __OFF_MIN __LLONG_MIN /* min value for an off_t */ 86178172Simp 87178172Simp/* Quads and long longs are the same size. Ensure they stay in sync. */ 88178172Simp#define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ 89178172Simp#define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ 90178172Simp#define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ 91178172Simp 92178172Simp#define __WORD_BIT 32 93178172Simp 94178172Simp#define __MINSIGSTKSZ (512 * 4) 95178172Simp 96178172Simp#endif /* !_MACHINE__LIMITS_H_ */ 97