limits.h revision 1.3
11.3Sdrochner/* $NetBSD: limits.h,v 1.3 2007/08/31 16:24:25 drochner Exp $ */ 21.1Scherry 31.1Scherry/* 41.1Scherry * Copyright (c) 1988 The Regents of the University of California. 51.1Scherry * All rights reserved. 61.1Scherry * 71.1Scherry * Redistribution and use in source and binary forms, with or without 81.1Scherry * modification, are permitted provided that the following conditions 91.1Scherry * are met: 101.1Scherry * 1. Redistributions of source code must retain the above copyright 111.1Scherry * notice, this list of conditions and the following disclaimer. 121.1Scherry * 2. Redistributions in binary form must reproduce the above copyright 131.1Scherry * notice, this list of conditions and the following disclaimer in the 141.1Scherry * documentation and/or other materials provided with the distribution. 151.1Scherry * 3. Neither the name of the University nor the names of its contributors 161.1Scherry * may be used to endorse or promote products derived from this software 171.1Scherry * without specific prior written permission. 181.1Scherry * 191.1Scherry * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 201.1Scherry * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 211.1Scherry * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 221.1Scherry * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 231.1Scherry * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 241.1Scherry * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 251.1Scherry * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 261.1Scherry * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 271.1Scherry * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 281.1Scherry * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 291.1Scherry * SUCH DAMAGE. 301.1Scherry * 311.1Scherry * @(#)limits.h 7.2 (Berkeley) 6/28/90 321.1Scherry */ 331.1Scherry 341.1Scherry#ifndef _MACHINE_LIMITS_H_ 351.1Scherry#define _MACHINE_LIMITS_H_ 361.1Scherry 371.1Scherry#define CHAR_BIT 8 /* number of bits in a char */ 381.1Scherry#define MB_LEN_MAX 32 /* no multibyte characters */ 391.1Scherry 401.1Scherry#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */ 411.1Scherry#define SCHAR_MAX 0x7f /* min value for a signed char */ 421.1Scherry 431.3Sdrochner#define UCHAR_MAX 0xff /* max value for an unsigned char */ 441.1Scherry#define CHAR_MAX 0x7f /* max value for a char */ 451.1Scherry#define CHAR_MIN (-0x7f-1) /* min value for a char */ 461.1Scherry 471.3Sdrochner#define USHRT_MAX 0xffff /* max value for an unsigned short */ 481.1Scherry#define SHRT_MAX 0x7fff /* max value for a short */ 491.1Scherry#define SHRT_MIN (-0x7fff-1) /* min value for a short */ 501.1Scherry 511.1Scherry#define UINT_MAX 0xffffffffU /* max value for an unsigned int */ 521.1Scherry#define INT_MAX 0x7fffffff /* max value for an int */ 531.1Scherry#define INT_MIN (-0x7fffffff-1) /* min value for an int */ 541.1Scherry 551.1Scherry#define ULONG_MAX 0xffffffffffffffffUL /* max value for an unsigned long */ 561.1Scherry#define LONG_MAX 0x7fffffffffffffffL /* max value for a long */ 571.1Scherry#define LONG_MIN (-0x7fffffffffffffffL-1) /* min value for a long */ 581.1Scherry 591.1Scherry 601.1Scherry#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 611.1Scherry defined(_NETBSD_SOURCE) 621.1Scherry#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ 631.1Scherry 641.1Scherry#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \ 651.1Scherry defined(_NETBSD_SOURCE) 661.1Scherry#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */ 671.1Scherry#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */ 681.1Scherry#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */ 691.1Scherry#endif 701.1Scherry 711.1Scherry#if defined(_NETBSD_SOURCE) 721.1Scherry#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */ 731.1Scherry 741.1Scherry/* GCC requires that quad constants be written as expressions. */ 751.1Scherry#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */ 761.1Scherry /* max value for a quad_t */ 771.1Scherry#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1)) 781.1Scherry#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */ 791.1Scherry 801.1Scherry#endif /* _NETBSD_SOURCE */ 811.1Scherry#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */ 821.1Scherry 831.1Scherry#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) 841.1Scherry#define LONG_BIT 64 851.1Scherry#define WORD_BIT 32 861.1Scherry 871.1Scherry#define DBL_DIG 15 881.1Scherry#define DBL_MAX 1.7976931348623157E+308 891.1Scherry#define DBL_MIN 2.2250738585072014E-308 901.1Scherry 911.1Scherry#define FLT_DIG 6 921.1Scherry#define FLT_MAX 3.40282347E+38F 931.1Scherry#define FLT_MIN 1.17549435E-38F 941.1Scherry#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */ 951.1Scherry 961.1Scherry 971.1Scherry 981.1Scherry#endif /* _MACHINE_LIMITS_H_ */ 99