149545b38SMike Barcroft /*- 249545b38SMike Barcroft * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> 349545b38SMike Barcroft * Copyright (c) 2001 The NetBSD Foundation, Inc. 449545b38SMike Barcroft * All rights reserved. 549545b38SMike Barcroft * 649545b38SMike Barcroft * This code is derived from software contributed to The NetBSD Foundation 749545b38SMike Barcroft * by Klaus Klein. 849545b38SMike Barcroft * 949545b38SMike Barcroft * Redistribution and use in source and binary forms, with or without 1049545b38SMike Barcroft * modification, are permitted provided that the following conditions 1149545b38SMike Barcroft * are met: 1249545b38SMike Barcroft * 1. Redistributions of source code must retain the above copyright 1349545b38SMike Barcroft * notice, this list of conditions and the following disclaimer. 1449545b38SMike Barcroft * 2. Redistributions in binary form must reproduce the above copyright 1549545b38SMike Barcroft * notice, this list of conditions and the following disclaimer in the 1649545b38SMike Barcroft * documentation and/or other materials provided with the distribution. 1749545b38SMike Barcroft * 3. All advertising materials mentioning features or use of this software 1849545b38SMike Barcroft * must display the following acknowledgement: 1949545b38SMike Barcroft * This product includes software developed by the NetBSD 2049545b38SMike Barcroft * Foundation, Inc. and its contributors. 2149545b38SMike Barcroft * 4. Neither the name of The NetBSD Foundation nor the names of its 2249545b38SMike Barcroft * contributors may be used to endorse or promote products derived 2349545b38SMike Barcroft * from this software without specific prior written permission. 2449545b38SMike Barcroft * 2549545b38SMike Barcroft * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2649545b38SMike Barcroft * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2749545b38SMike Barcroft * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2849545b38SMike Barcroft * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2949545b38SMike Barcroft * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3049545b38SMike Barcroft * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3149545b38SMike Barcroft * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3249545b38SMike Barcroft * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3349545b38SMike Barcroft * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3449545b38SMike Barcroft * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3549545b38SMike Barcroft * POSSIBILITY OF SUCH DAMAGE. 3649545b38SMike Barcroft * 3749545b38SMike Barcroft * $FreeBSD$ 3849545b38SMike Barcroft */ 3949545b38SMike Barcroft 4049545b38SMike Barcroft #ifndef _MACHINE__STDINT_H_ 4149545b38SMike Barcroft #define _MACHINE__STDINT_H_ 4249545b38SMike Barcroft 4349545b38SMike Barcroft #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) 4449545b38SMike Barcroft 4549545b38SMike Barcroft #define INT8_C(c) (c) 4649545b38SMike Barcroft #define INT16_C(c) (c) 4749545b38SMike Barcroft #define INT32_C(c) (c) 4849545b38SMike Barcroft #define INT64_C(c) (c ## LL) 4949545b38SMike Barcroft 5049545b38SMike Barcroft #define UINT8_C(c) (c) 5149545b38SMike Barcroft #define UINT16_C(c) (c) 5249545b38SMike Barcroft #define UINT32_C(c) (c ## U) 5349545b38SMike Barcroft #define UINT64_C(c) (c ## ULL) 5449545b38SMike Barcroft 5549545b38SMike Barcroft #define INTMAX_C(c) (c ## LL) 5649545b38SMike Barcroft #define UINTMAX_C(c) (c ## ULL) 5749545b38SMike Barcroft 5849545b38SMike Barcroft #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ 5949545b38SMike Barcroft 6049545b38SMike Barcroft #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) 6149545b38SMike Barcroft 6249545b38SMike Barcroft /* 6349545b38SMike Barcroft * ISO/IEC 9899:1999 6449545b38SMike Barcroft * 7.18.2.1 Limits of exact-width integer types 6549545b38SMike Barcroft */ 6649545b38SMike Barcroft /* Minimum values of exact-width signed integer types. */ 6749545b38SMike Barcroft #define INT8_MIN (-0x7f-1) 6849545b38SMike Barcroft #define INT16_MIN (-0x7fff-1) 6949545b38SMike Barcroft #define INT32_MIN (-0x7fffffff-1) 7049545b38SMike Barcroft #define INT64_MIN (-0x7fffffffffffffffLL-1) 7149545b38SMike Barcroft 7249545b38SMike Barcroft /* Maximum values of exact-width signed integer types. */ 7349545b38SMike Barcroft #define INT8_MAX 0x7f 7449545b38SMike Barcroft #define INT16_MAX 0x7fff 7549545b38SMike Barcroft #define INT32_MAX 0x7fffffff 7649545b38SMike Barcroft #define INT64_MAX 0x7fffffffffffffffLL 7749545b38SMike Barcroft 7849545b38SMike Barcroft /* Maximum values of exact-width unsigned integer types. */ 7949545b38SMike Barcroft #define UINT8_MAX 0xff 8049545b38SMike Barcroft #define UINT16_MAX 0xffff 8149545b38SMike Barcroft #define UINT32_MAX 0xffffffffU 8249545b38SMike Barcroft #define UINT64_MAX 0xffffffffffffffffULL 8349545b38SMike Barcroft 8449545b38SMike Barcroft /* 8549545b38SMike Barcroft * ISO/IEC 9899:1999 8649545b38SMike Barcroft * 7.18.2.2 Limits of minimum-width integer types 8749545b38SMike Barcroft */ 8849545b38SMike Barcroft /* Minimum values of minimum-width signed integer types. */ 8949545b38SMike Barcroft #define INT_LEAST8_MIN INT8_MIN 9049545b38SMike Barcroft #define INT_LEAST16_MIN INT16_MIN 9149545b38SMike Barcroft #define INT_LEAST32_MIN INT32_MIN 9249545b38SMike Barcroft #define INT_LEAST64_MIN INT64_MIN 9349545b38SMike Barcroft 9449545b38SMike Barcroft /* Maximum values of minimum-width signed integer types. */ 9549545b38SMike Barcroft #define INT_LEAST8_MAX INT8_MAX 9649545b38SMike Barcroft #define INT_LEAST16_MAX INT16_MAX 9749545b38SMike Barcroft #define INT_LEAST32_MAX INT32_MAX 9849545b38SMike Barcroft #define INT_LEAST64_MAX INT64_MAX 9949545b38SMike Barcroft 10049545b38SMike Barcroft /* Maximum values of minimum-width unsigned integer types. */ 10149545b38SMike Barcroft #define UINT_LEAST8_MAX UINT8_MAX 10249545b38SMike Barcroft #define UINT_LEAST16_MAX UINT16_MAX 10349545b38SMike Barcroft #define UINT_LEAST32_MAX UINT32_MAX 10449545b38SMike Barcroft #define UINT_LEAST64_MAX UINT64_MAX 10549545b38SMike Barcroft 10649545b38SMike Barcroft /* 10749545b38SMike Barcroft * ISO/IEC 9899:1999 10849545b38SMike Barcroft * 7.18.2.3 Limits of fastest minimum-width integer types 10949545b38SMike Barcroft */ 11049545b38SMike Barcroft /* Minimum values of fastest minimum-width signed integer types. */ 11149545b38SMike Barcroft #define INT_FAST8_MIN INT32_MIN 11249545b38SMike Barcroft #define INT_FAST16_MIN INT32_MIN 11349545b38SMike Barcroft #define INT_FAST32_MIN INT32_MIN 11449545b38SMike Barcroft #define INT_FAST64_MIN INT64_MIN 11549545b38SMike Barcroft 11649545b38SMike Barcroft /* Maximum values of fastest minimum-width signed integer types. */ 11749545b38SMike Barcroft #define INT_FAST8_MAX INT32_MAX 11849545b38SMike Barcroft #define INT_FAST16_MAX INT32_MAX 11949545b38SMike Barcroft #define INT_FAST32_MAX INT32_MAX 12049545b38SMike Barcroft #define INT_FAST64_MAX INT64_MAX 12149545b38SMike Barcroft 12249545b38SMike Barcroft /* Maximum values of fastest minimum-width unsigned integer types. */ 12349545b38SMike Barcroft #define UINT_FAST8_MAX UINT32_MAX 12449545b38SMike Barcroft #define UINT_FAST16_MAX UINT32_MAX 12549545b38SMike Barcroft #define UINT_FAST32_MAX UINT32_MAX 12649545b38SMike Barcroft #define UINT_FAST64_MAX UINT64_MAX 12749545b38SMike Barcroft 12849545b38SMike Barcroft /* 12949545b38SMike Barcroft * ISO/IEC 9899:1999 13049545b38SMike Barcroft * 7.18.2.4 Limits of integer types capable of holding object pointers 13149545b38SMike Barcroft */ 13249545b38SMike Barcroft #define INTPTR_MIN INT32_MIN 13349545b38SMike Barcroft #define INTPTR_MAX INT32_MAX 13449545b38SMike Barcroft #define UINTPTR_MAX UINT32_MAX 13549545b38SMike Barcroft 13649545b38SMike Barcroft /* 13749545b38SMike Barcroft * ISO/IEC 9899:1999 13849545b38SMike Barcroft * 7.18.2.5 Limits of greatest-width integer types 13949545b38SMike Barcroft */ 14049545b38SMike Barcroft #define INTMAX_MIN INT64_MIN 14149545b38SMike Barcroft #define INTMAX_MAX INT64_MAX 14249545b38SMike Barcroft #define UINTMAX_MAX UINT64_MAX 14349545b38SMike Barcroft 14449545b38SMike Barcroft /* 14549545b38SMike Barcroft * ISO/IEC 9899:1999 14649545b38SMike Barcroft * 7.18.3 Limits of other integer types 14749545b38SMike Barcroft */ 14849545b38SMike Barcroft /* Limits of ptrdiff_t. */ 14949545b38SMike Barcroft #define PTRDIFF_MIN INT32_MIN 15049545b38SMike Barcroft #define PTRDIFF_MAX INT32_MAX 15149545b38SMike Barcroft 15249545b38SMike Barcroft /* Limits of sig_atomic_t. */ 15349545b38SMike Barcroft #define SIG_ATOMIC_MIN INT32_MIN 15449545b38SMike Barcroft #define SIG_ATOMIC_MAX INT32_MAX 15549545b38SMike Barcroft 15649545b38SMike Barcroft /* Limit of size_t. */ 15749545b38SMike Barcroft #define SIZE_MAX UINT32_MAX 15849545b38SMike Barcroft 15949545b38SMike Barcroft #ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */ 16049545b38SMike Barcroft /* Limits of wchar_t. */ 16149545b38SMike Barcroft #define WCHAR_MIN INT32_MIN 16249545b38SMike Barcroft #define WCHAR_MAX INT32_MAX 16349545b38SMike Barcroft 16449545b38SMike Barcroft /* Limits of wint_t. */ 16549545b38SMike Barcroft #define WINT_MIN INT32_MIN 16649545b38SMike Barcroft #define WINT_MAX INT32_MAX 16749545b38SMike Barcroft #endif 16849545b38SMike Barcroft 16949545b38SMike Barcroft #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ 17049545b38SMike Barcroft 17149545b38SMike Barcroft #endif /* !_MACHINE__STDINT_H_ */ 172