1*480020cdSdholland /* $NetBSD: limits.h,v 1.15 2019/01/21 20:28:18 dholland Exp $ */ 265363da2Sitojun 365363da2Sitojun /* 465363da2Sitojun * Copyright (c) 1988 The Regents of the University of California. 565363da2Sitojun * All rights reserved. 665363da2Sitojun * 765363da2Sitojun * Redistribution and use in source and binary forms, with or without 865363da2Sitojun * modification, are permitted provided that the following conditions 965363da2Sitojun * are met: 1065363da2Sitojun * 1. Redistributions of source code must retain the above copyright 1165363da2Sitojun * notice, this list of conditions and the following disclaimer. 1265363da2Sitojun * 2. Redistributions in binary form must reproduce the above copyright 1365363da2Sitojun * notice, this list of conditions and the following disclaimer in the 1465363da2Sitojun * documentation and/or other materials provided with the distribution. 15aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 1665363da2Sitojun * may be used to endorse or promote products derived from this software 1765363da2Sitojun * without specific prior written permission. 1865363da2Sitojun * 1965363da2Sitojun * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2065363da2Sitojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2165363da2Sitojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2265363da2Sitojun * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2365363da2Sitojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2465363da2Sitojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2565363da2Sitojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2665363da2Sitojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2765363da2Sitojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2865363da2Sitojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2965363da2Sitojun * SUCH DAMAGE. 3065363da2Sitojun * 3165363da2Sitojun * @(#)limits.h 7.2 (Berkeley) 6/28/90 3265363da2Sitojun */ 3365363da2Sitojun 3493da9db9Such #ifndef _SH3_LIMITS_H_ 3593da9db9Such #define _SH3_LIMITS_H_ 3665363da2Sitojun 374be7a2dcSbjh21 #include <sys/featuretest.h> 384be7a2dcSbjh21 3965363da2Sitojun #define CHAR_BIT 8 /* number of bits in a char */ 4065363da2Sitojun 417484a2dbSchristos #define UCHAR_MAX 0xff /* max value for an unsigned char */ 4265363da2Sitojun #define SCHAR_MAX 0x7f /* max value for a signed char */ 4365363da2Sitojun #define SCHAR_MIN (-0x7f-1) /* min value for a signed char */ 4465363da2Sitojun 450e0fe2c3Sdrochner #define USHRT_MAX 0xffff /* max value for an unsigned short */ 4665363da2Sitojun #define SHRT_MAX 0x7fff /* max value for a short */ 4765363da2Sitojun #define SHRT_MIN (-0x7fff-1) /* min value for a short */ 4865363da2Sitojun 4965363da2Sitojun #define UINT_MAX 0xffffffffU /* max value for an unsigned int */ 5065363da2Sitojun #define INT_MAX 0x7fffffff /* max value for an int */ 5165363da2Sitojun #define INT_MIN (-0x7fffffff-1) /* min value for an int */ 5265363da2Sitojun 5365363da2Sitojun #define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ 5465363da2Sitojun #define LONG_MAX 0x7fffffffL /* max value for a long */ 5565363da2Sitojun #define LONG_MIN (-0x7fffffffL-1) /* min value for a long */ 5665363da2Sitojun 574be7a2dcSbjh21 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \ 584be7a2dcSbjh21 defined(_NETBSD_SOURCE) 59ad7dbd82Skleink #define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */ 60ad7dbd82Skleink #define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */ 61ad7dbd82Skleink #define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */ 62ad7dbd82Skleink #endif 63ad7dbd82Skleink 64*480020cdSdholland #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 65*480020cdSdholland defined(_NETBSD_SOURCE) 66*480020cdSdholland #define SSIZE_MAX INT_MAX /* max value for a ssize_t */ 67*480020cdSdholland 684be7a2dcSbjh21 #if defined(_NETBSD_SOURCE) 69caafbf4eSchristos #define SSIZE_MIN INT_MIN /* min value for a ssize_t */ 7065363da2Sitojun #define SIZE_T_MAX UINT_MAX /* max value for a size_t */ 7165363da2Sitojun 7265363da2Sitojun #define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */ 7365363da2Sitojun #define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ 7465363da2Sitojun #define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ 7565363da2Sitojun 764be7a2dcSbjh21 #endif /* _NETBSD_SOURCE */ 774be7a2dcSbjh21 #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */ 7865363da2Sitojun 794be7a2dcSbjh21 #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) 8065363da2Sitojun #define LONG_BIT 32 8165363da2Sitojun #define WORD_BIT 32 8265363da2Sitojun 838ed9a6d8Smatt #define DBL_DIG __DBL_DIG__ 848ed9a6d8Smatt #define DBL_MAX __DBL_MAX__ 858ed9a6d8Smatt #define DBL_MIN __DBL_MIN__ 8665363da2Sitojun 878ed9a6d8Smatt #define FLT_DIG __FLT_DIG__ 888ed9a6d8Smatt #define FLT_MAX __FLT_MAX__ 898ed9a6d8Smatt #define FLT_MIN __FLT_MIN__ 9065363da2Sitojun #endif 9165363da2Sitojun 9293da9db9Such #endif /* !_SH3_LIMITS_H_ */ 93