1*f6aac1c3SLionel Sambuc /* $NetBSD: int_limits.h,v 1.8 2008/04/28 20:23:24 martin Exp $ */ 2*f6aac1c3SLionel Sambuc 3*f6aac1c3SLionel Sambuc /*- 4*f6aac1c3SLionel Sambuc * Copyright (c) 2001 The NetBSD Foundation, Inc. 5*f6aac1c3SLionel Sambuc * All rights reserved. 6*f6aac1c3SLionel Sambuc * 7*f6aac1c3SLionel Sambuc * This code is derived from software contributed to The NetBSD Foundation 8*f6aac1c3SLionel Sambuc * by Klaus Klein. 9*f6aac1c3SLionel Sambuc * 10*f6aac1c3SLionel Sambuc * Redistribution and use in source and binary forms, with or without 11*f6aac1c3SLionel Sambuc * modification, are permitted provided that the following conditions 12*f6aac1c3SLionel Sambuc * are met: 13*f6aac1c3SLionel Sambuc * 1. Redistributions of source code must retain the above copyright 14*f6aac1c3SLionel Sambuc * notice, this list of conditions and the following disclaimer. 15*f6aac1c3SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 16*f6aac1c3SLionel Sambuc * notice, this list of conditions and the following disclaimer in the 17*f6aac1c3SLionel Sambuc * documentation and/or other materials provided with the distribution. 18*f6aac1c3SLionel Sambuc * 19*f6aac1c3SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*f6aac1c3SLionel Sambuc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*f6aac1c3SLionel Sambuc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*f6aac1c3SLionel Sambuc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*f6aac1c3SLionel Sambuc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*f6aac1c3SLionel Sambuc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*f6aac1c3SLionel Sambuc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*f6aac1c3SLionel Sambuc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*f6aac1c3SLionel Sambuc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*f6aac1c3SLionel Sambuc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*f6aac1c3SLionel Sambuc * POSSIBILITY OF SUCH DAMAGE. 30*f6aac1c3SLionel Sambuc */ 31*f6aac1c3SLionel Sambuc 32*f6aac1c3SLionel Sambuc #ifndef _I386_INT_LIMITS_H_ 33*f6aac1c3SLionel Sambuc #define _I386_INT_LIMITS_H_ 34*f6aac1c3SLionel Sambuc 35*f6aac1c3SLionel Sambuc /* 36*f6aac1c3SLionel Sambuc * 7.18.2 Limits of specified-width integer types 37*f6aac1c3SLionel Sambuc */ 38*f6aac1c3SLionel Sambuc 39*f6aac1c3SLionel Sambuc /* 7.18.2.1 Limits of exact-width integer types */ 40*f6aac1c3SLionel Sambuc 41*f6aac1c3SLionel Sambuc /* minimum values of exact-width signed integer types */ 42*f6aac1c3SLionel Sambuc #define INT8_MIN (-0x7f-1) /* int8_t */ 43*f6aac1c3SLionel Sambuc #define INT16_MIN (-0x7fff-1) /* int16_t */ 44*f6aac1c3SLionel Sambuc #define INT32_MIN (-0x7fffffff-1) /* int32_t */ 45*f6aac1c3SLionel Sambuc #define INT64_MIN (-0x7fffffffffffffffLL-1) /* int64_t */ 46*f6aac1c3SLionel Sambuc 47*f6aac1c3SLionel Sambuc /* maximum values of exact-width signed integer types */ 48*f6aac1c3SLionel Sambuc #define INT8_MAX 0x7f /* int8_t */ 49*f6aac1c3SLionel Sambuc #define INT16_MAX 0x7fff /* int16_t */ 50*f6aac1c3SLionel Sambuc #define INT32_MAX 0x7fffffff /* int32_t */ 51*f6aac1c3SLionel Sambuc #define INT64_MAX 0x7fffffffffffffffLL /* int64_t */ 52*f6aac1c3SLionel Sambuc 53*f6aac1c3SLionel Sambuc /* maximum values of exact-width unsigned integer types */ 54*f6aac1c3SLionel Sambuc #define UINT8_MAX 0xff /* uint8_t */ 55*f6aac1c3SLionel Sambuc #define UINT16_MAX 0xffff /* uint16_t */ 56*f6aac1c3SLionel Sambuc #define UINT32_MAX 0xffffffffU /* uint32_t */ 57*f6aac1c3SLionel Sambuc #define UINT64_MAX 0xffffffffffffffffULL /* uint64_t */ 58*f6aac1c3SLionel Sambuc 59*f6aac1c3SLionel Sambuc /* 7.18.2.2 Limits of minimum-width integer types */ 60*f6aac1c3SLionel Sambuc 61*f6aac1c3SLionel Sambuc /* minimum values of minimum-width signed integer types */ 62*f6aac1c3SLionel Sambuc #define INT_LEAST8_MIN (-0x7f-1) /* int_least8_t */ 63*f6aac1c3SLionel Sambuc #define INT_LEAST16_MIN (-0x7fff-1) /* int_least16_t */ 64*f6aac1c3SLionel Sambuc #define INT_LEAST32_MIN (-0x7fffffff-1) /* int_least32_t */ 65*f6aac1c3SLionel Sambuc #define INT_LEAST64_MIN (-0x7fffffffffffffffLL-1) /* int_least64_t */ 66*f6aac1c3SLionel Sambuc 67*f6aac1c3SLionel Sambuc /* maximum values of minimum-width signed integer types */ 68*f6aac1c3SLionel Sambuc #define INT_LEAST8_MAX 0x7f /* int_least8_t */ 69*f6aac1c3SLionel Sambuc #define INT_LEAST16_MAX 0x7fff /* int_least16_t */ 70*f6aac1c3SLionel Sambuc #define INT_LEAST32_MAX 0x7fffffff /* int_least32_t */ 71*f6aac1c3SLionel Sambuc #define INT_LEAST64_MAX 0x7fffffffffffffffLL /* int_least64_t */ 72*f6aac1c3SLionel Sambuc 73*f6aac1c3SLionel Sambuc /* maximum values of minimum-width unsigned integer types */ 74*f6aac1c3SLionel Sambuc #define UINT_LEAST8_MAX 0xff /* uint_least8_t */ 75*f6aac1c3SLionel Sambuc #define UINT_LEAST16_MAX 0xffff /* uint_least16_t */ 76*f6aac1c3SLionel Sambuc #define UINT_LEAST32_MAX 0xffffffffU /* uint_least32_t */ 77*f6aac1c3SLionel Sambuc #define UINT_LEAST64_MAX 0xffffffffffffffffULL /* uint_least64_t */ 78*f6aac1c3SLionel Sambuc 79*f6aac1c3SLionel Sambuc /* 7.18.2.3 Limits of fastest minimum-width integer types */ 80*f6aac1c3SLionel Sambuc 81*f6aac1c3SLionel Sambuc /* minimum values of fastest minimum-width signed integer types */ 82*f6aac1c3SLionel Sambuc #define INT_FAST8_MIN (-0x7f-1) /* int_fast8_t */ 83*f6aac1c3SLionel Sambuc #define INT_FAST16_MIN (-0x7fffffff-1) /* int_fast16_t */ 84*f6aac1c3SLionel Sambuc #define INT_FAST32_MIN (-0x7fffffff-1) /* int_fast32_t */ 85*f6aac1c3SLionel Sambuc #define INT_FAST64_MIN (-0x7fffffffffffffffLL-1) /* int_fast64_t */ 86*f6aac1c3SLionel Sambuc 87*f6aac1c3SLionel Sambuc /* maximum values of fastest minimum-width signed integer types */ 88*f6aac1c3SLionel Sambuc #define INT_FAST8_MAX 0x7f /* int_fast8_t */ 89*f6aac1c3SLionel Sambuc #define INT_FAST16_MAX 0x7fffffff /* int_fast16_t */ 90*f6aac1c3SLionel Sambuc #define INT_FAST32_MAX 0x7fffffff /* int_fast32_t */ 91*f6aac1c3SLionel Sambuc #define INT_FAST64_MAX 0x7fffffffffffffffLL /* int_fast64_t */ 92*f6aac1c3SLionel Sambuc 93*f6aac1c3SLionel Sambuc /* maximum values of fastest minimum-width unsigned integer types */ 94*f6aac1c3SLionel Sambuc #define UINT_FAST8_MAX 0xff /* uint_fast8_t */ 95*f6aac1c3SLionel Sambuc #define UINT_FAST16_MAX 0xffffffffU /* uint_fast16_t */ 96*f6aac1c3SLionel Sambuc #define UINT_FAST32_MAX 0xffffffffU /* uint_fast32_t */ 97*f6aac1c3SLionel Sambuc #define UINT_FAST64_MAX 0xffffffffffffffffULL /* uint_fast64_t */ 98*f6aac1c3SLionel Sambuc 99*f6aac1c3SLionel Sambuc /* 7.18.2.4 Limits of integer types capable of holding object pointers */ 100*f6aac1c3SLionel Sambuc 101*f6aac1c3SLionel Sambuc #define INTPTR_MIN (-0x7fffffff-1) /* intptr_t */ 102*f6aac1c3SLionel Sambuc #define INTPTR_MAX 0x7fffffff /* intptr_t */ 103*f6aac1c3SLionel Sambuc #define UINTPTR_MAX 0xffffffffU /* uintptr_t */ 104*f6aac1c3SLionel Sambuc 105*f6aac1c3SLionel Sambuc /* 7.18.2.5 Limits of greatest-width integer types */ 106*f6aac1c3SLionel Sambuc 107*f6aac1c3SLionel Sambuc #define INTMAX_MIN (-0x7fffffffffffffffLL-1) /* intmax_t */ 108*f6aac1c3SLionel Sambuc #define INTMAX_MAX 0x7fffffffffffffffLL /* intmax_t */ 109*f6aac1c3SLionel Sambuc #define UINTMAX_MAX 0xffffffffffffffffULL /* uintmax_t */ 110*f6aac1c3SLionel Sambuc 111*f6aac1c3SLionel Sambuc 112*f6aac1c3SLionel Sambuc /* 113*f6aac1c3SLionel Sambuc * 7.18.3 Limits of other integer types 114*f6aac1c3SLionel Sambuc */ 115*f6aac1c3SLionel Sambuc 116*f6aac1c3SLionel Sambuc /* limits of ptrdiff_t */ 117*f6aac1c3SLionel Sambuc #define PTRDIFF_MIN (-0x7fffffff-1) /* ptrdiff_t */ 118*f6aac1c3SLionel Sambuc #define PTRDIFF_MAX 0x7fffffff /* ptrdiff_t */ 119*f6aac1c3SLionel Sambuc 120*f6aac1c3SLionel Sambuc /* limits of sig_atomic_t */ 121*f6aac1c3SLionel Sambuc #define SIG_ATOMIC_MIN (-0x7fffffff-1) /* sig_atomic_t */ 122*f6aac1c3SLionel Sambuc #define SIG_ATOMIC_MAX 0x7fffffff /* sig_atomic_t */ 123*f6aac1c3SLionel Sambuc 124*f6aac1c3SLionel Sambuc /* limit of size_t */ 125*f6aac1c3SLionel Sambuc #define SIZE_MAX 0xffffffffU /* size_t */ 126*f6aac1c3SLionel Sambuc 127*f6aac1c3SLionel Sambuc #endif /* !_I386_INT_LIMITS_H_ */ 128