1*0a6a1f1dSLionel Sambuc /* $NetBSD: limits.h,v 1.25 2014/04/21 10:53:47 matt Exp $ */ 2f6aac1c3SLionel Sambuc 3f6aac1c3SLionel Sambuc /* 4f6aac1c3SLionel Sambuc * Copyright (c) 1988 The Regents of the University of California. 5f6aac1c3SLionel Sambuc * All rights reserved. 6f6aac1c3SLionel Sambuc * 7f6aac1c3SLionel Sambuc * Redistribution and use in source and binary forms, with or without 8f6aac1c3SLionel Sambuc * modification, are permitted provided that the following conditions 9f6aac1c3SLionel Sambuc * are met: 10f6aac1c3SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 11f6aac1c3SLionel Sambuc * notice, this list of conditions and the following disclaimer. 12f6aac1c3SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 13f6aac1c3SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 14f6aac1c3SLionel Sambuc * documentation and/or other materials provided with the distribution. 15f6aac1c3SLionel Sambuc * 3. Neither the name of the University nor the names of its contributors 16f6aac1c3SLionel Sambuc * may be used to endorse or promote products derived from this software 17f6aac1c3SLionel Sambuc * without specific prior written permission. 18f6aac1c3SLionel Sambuc * 19f6aac1c3SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20f6aac1c3SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21f6aac1c3SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22f6aac1c3SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23f6aac1c3SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24f6aac1c3SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25f6aac1c3SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26f6aac1c3SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27f6aac1c3SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28f6aac1c3SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29f6aac1c3SLionel Sambuc * SUCH DAMAGE. 30f6aac1c3SLionel Sambuc * 31f6aac1c3SLionel Sambuc * @(#)limits.h 7.2 (Berkeley) 6/28/90 32f6aac1c3SLionel Sambuc */ 33f6aac1c3SLionel Sambuc 34f6aac1c3SLionel Sambuc #ifndef _I386_LIMITS_H_ 35f6aac1c3SLionel Sambuc #define _I386_LIMITS_H_ 36f6aac1c3SLionel Sambuc 37f6aac1c3SLionel Sambuc #include <sys/featuretest.h> 38f6aac1c3SLionel Sambuc 39f6aac1c3SLionel Sambuc #define CHAR_BIT 8 /* number of bits in a char */ 40f6aac1c3SLionel Sambuc 41f14fb602SLionel Sambuc #define UCHAR_MAX 0xff /* max value for an unsigned char */ 42f6aac1c3SLionel Sambuc #define SCHAR_MAX 0x7f /* max value for a signed char */ 43f6aac1c3SLionel Sambuc #define SCHAR_MIN (-0x7f-1) /* min value for a signed char */ 44f6aac1c3SLionel Sambuc 45f6aac1c3SLionel Sambuc #define USHRT_MAX 0xffff /* max value for an unsigned short */ 46f6aac1c3SLionel Sambuc #define SHRT_MAX 0x7fff /* max value for a short */ 47f6aac1c3SLionel Sambuc #define SHRT_MIN (-0x7fff-1) /* min value for a short */ 48f6aac1c3SLionel Sambuc 49f6aac1c3SLionel Sambuc #define UINT_MAX 0xffffffffU /* max value for an unsigned int */ 50f6aac1c3SLionel Sambuc #define INT_MAX 0x7fffffff /* max value for an int */ 51f6aac1c3SLionel Sambuc #define INT_MIN (-0x7fffffff-1) /* min value for an int */ 52f6aac1c3SLionel Sambuc 53f6aac1c3SLionel Sambuc #define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ 54f6aac1c3SLionel Sambuc #define LONG_MAX 0x7fffffffL /* max value for a long */ 55f6aac1c3SLionel Sambuc #define LONG_MIN (-0x7fffffffL-1) /* min value for a long */ 56f6aac1c3SLionel Sambuc 57f6aac1c3SLionel Sambuc #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 58f6aac1c3SLionel Sambuc defined(_NETBSD_SOURCE) 59f6aac1c3SLionel Sambuc #define SSIZE_MAX INT_MAX /* max value for a ssize_t */ 60f6aac1c3SLionel Sambuc 61f6aac1c3SLionel Sambuc #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \ 62f6aac1c3SLionel Sambuc defined(_NETBSD_SOURCE) 63f6aac1c3SLionel Sambuc #define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */ 64f6aac1c3SLionel Sambuc #define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */ 65f6aac1c3SLionel Sambuc #define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */ 66f6aac1c3SLionel Sambuc #endif 67f6aac1c3SLionel Sambuc 68f6aac1c3SLionel Sambuc #if defined(_NETBSD_SOURCE) 6984d9c625SLionel Sambuc #define SSIZE_MIN INT_MIN /* min value for a ssize_t */ 70f6aac1c3SLionel Sambuc #define SIZE_T_MAX UINT_MAX /* max value for a size_t */ 71f6aac1c3SLionel Sambuc 72f6aac1c3SLionel Sambuc #define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */ 73f6aac1c3SLionel Sambuc #define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ 74f6aac1c3SLionel Sambuc #define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ 75f6aac1c3SLionel Sambuc 76f6aac1c3SLionel Sambuc #endif /* _NETBSD_SOURCE */ 77f6aac1c3SLionel Sambuc #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */ 78f6aac1c3SLionel Sambuc 79f6aac1c3SLionel Sambuc #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) 80f6aac1c3SLionel Sambuc #define LONG_BIT 32 81f6aac1c3SLionel Sambuc #define WORD_BIT 32 82f6aac1c3SLionel Sambuc 83*0a6a1f1dSLionel Sambuc #define DBL_DIG __DBL_DIG__ 84*0a6a1f1dSLionel Sambuc #define DBL_MAX __DBL_MAX__ 85*0a6a1f1dSLionel Sambuc #define DBL_MIN __DBL_MIN__ 86f6aac1c3SLionel Sambuc 87*0a6a1f1dSLionel Sambuc #define FLT_DIG __FLT_DIG__ 88*0a6a1f1dSLionel Sambuc #define FLT_MAX __FLT_MAX__ 89*0a6a1f1dSLionel Sambuc #define FLT_MIN __FLT_MIN__ 90f6aac1c3SLionel Sambuc #endif 91f6aac1c3SLionel Sambuc 92f6aac1c3SLionel Sambuc #endif /* _I386_LIMITS_H_ */ 93