/*-1* SPDX-License-Identifier: BSD-4-Clause2*3* Copyright (c) 2001, 2002 Mike Barcroft <[email protected]>4* Copyright (c) 2001 The NetBSD Foundation, Inc.5* All rights reserved.6*7* This code is derived from software contributed to The NetBSD Foundation8* by Klaus Klein.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice, this list of conditions and the following disclaimer.15* 2. Redistributions in binary form must reproduce the above copyright16* notice, this list of conditions and the following disclaimer in the17* documentation and/or other materials provided with the distribution.18* 3. All advertising materials mentioning features or use of this software19* must display the following acknowledgement:20* This product includes software developed by the NetBSD21* Foundation, Inc. and its contributors.22* 4. Neither the name of The NetBSD Foundation nor the names of its23* contributors may be used to endorse or promote products derived24* from this software without specific prior written permission.25*26* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS27* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED28* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR29* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS30* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR31* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF32* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS33* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN34* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)35* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE36* POSSIBILITY OF SUCH DAMAGE.37*/3839#ifndef _MACHINE__STDINT_H_40#define _MACHINE__STDINT_H_4142#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)4344#define INT8_C(c) (c)45#define INT16_C(c) (c)46#define INT32_C(c) (c)4748#define UINT8_C(c) (c)49#define UINT16_C(c) (c)50#define UINT32_C(c) (c ## U)5152#ifdef __LP64__53#define INT64_C(c) (c ## L)54#define UINT64_C(c) (c ## UL)55#else56#define INT64_C(c) (c ## LL)57#define UINT64_C(c) (c ## ULL)58#endif5960#define INTMAX_C(c) INT64_C(c)61#define UINTMAX_C(c) UINT64_C(c)6263#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */6465#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)6667#ifndef __INT64_C68#ifdef __LP64__69#define __INT64_C(c) (c ## L)70#define __UINT64_C(c) (c ## UL)71#else72#define __INT64_C(c) (c ## LL)73#define __UINT64_C(c) (c ## ULL)74#endif75#endif7677/*78* ISO/IEC 9899:199979* 7.18.2.1 Limits of exact-width integer types80*/81/* Minimum values of exact-width signed integer types. */82#define INT8_MIN (-0x7f-1)83#define INT16_MIN (-0x7fff-1)84#define INT32_MIN (-0x7fffffff-1)85#define INT64_MIN (-__INT64_C(0x7fffffffffffffff)-1)8687/* Maximum values of exact-width signed integer types. */88#define INT8_MAX 0x7f89#define INT16_MAX 0x7fff90#define INT32_MAX 0x7fffffff91#define INT64_MAX __INT64_C(0x7fffffffffffffff)9293/* Maximum values of exact-width unsigned integer types. */94#define UINT8_MAX 0xff95#define UINT16_MAX 0xffff96#define UINT32_MAX 0xffffffff97#define UINT64_MAX __UINT64_C(0xffffffffffffffff)9899/*100* ISO/IEC 9899:1999101* 7.18.2.2 Limits of minimum-width integer types102*/103/* Minimum values of minimum-width signed integer types. */104#define INT_LEAST8_MIN INT8_MIN105#define INT_LEAST16_MIN INT16_MIN106#define INT_LEAST32_MIN INT32_MIN107#define INT_LEAST64_MIN INT64_MIN108109/* Maximum values of minimum-width signed integer types. */110#define INT_LEAST8_MAX INT8_MAX111#define INT_LEAST16_MAX INT16_MAX112#define INT_LEAST32_MAX INT32_MAX113#define INT_LEAST64_MAX INT64_MAX114115/* Maximum values of minimum-width unsigned integer types. */116#define UINT_LEAST8_MAX UINT8_MAX117#define UINT_LEAST16_MAX UINT16_MAX118#define UINT_LEAST32_MAX UINT32_MAX119#define UINT_LEAST64_MAX UINT64_MAX120121/*122* ISO/IEC 9899:1999123* 7.18.2.3 Limits of fastest minimum-width integer types124*/125/* Minimum values of fastest minimum-width signed integer types. */126#define INT_FAST8_MIN INT32_MIN127#define INT_FAST16_MIN INT32_MIN128#define INT_FAST32_MIN INT32_MIN129#define INT_FAST64_MIN INT64_MIN130131/* Maximum values of fastest minimum-width signed integer types. */132#define INT_FAST8_MAX INT32_MAX133#define INT_FAST16_MAX INT32_MAX134#define INT_FAST32_MAX INT32_MAX135#define INT_FAST64_MAX INT64_MAX136137/* Maximum values of fastest minimum-width unsigned integer types. */138#define UINT_FAST8_MAX UINT32_MAX139#define UINT_FAST16_MAX UINT32_MAX140#define UINT_FAST32_MAX UINT32_MAX141#define UINT_FAST64_MAX UINT64_MAX142143/*144* ISO/IEC 9899:1999145* 7.18.2.4 Limits of integer types capable of holding object pointers146*/147#ifdef __LP64__148#define INTPTR_MIN INT64_MIN149#define INTPTR_MAX INT64_MAX150#define UINTPTR_MAX UINT64_MAX151#else152#define INTPTR_MIN INT32_MIN153#define INTPTR_MAX INT32_MAX154#define UINTPTR_MAX UINT32_MAX155#endif156157/*158* ISO/IEC 9899:1999159* 7.18.2.5 Limits of greatest-width integer types160*/161#define INTMAX_MIN INT64_MIN162#define INTMAX_MAX INT64_MAX163#define UINTMAX_MAX UINT64_MAX164165/*166* ISO/IEC 9899:1999167* 7.18.3 Limits of other integer types168*/169#ifdef __LP64__170/* Limits of ptrdiff_t. */171#define PTRDIFF_MIN INT64_MIN172#define PTRDIFF_MAX INT64_MAX173174/* Limits of sig_atomic_t. */175#define SIG_ATOMIC_MIN INT64_MIN176#define SIG_ATOMIC_MAX INT64_MAX177178/* Limit of size_t. */179#define SIZE_MAX UINT64_MAX180#else181/* Limits of ptrdiff_t. */182#define PTRDIFF_MIN INT32_MIN183#define PTRDIFF_MAX INT32_MAX184185/* Limits of sig_atomic_t. */186#define SIG_ATOMIC_MIN INT32_MIN187#define SIG_ATOMIC_MAX INT32_MAX188189/* Limit of size_t. */190#define SIZE_MAX UINT32_MAX191#endif192193/* Limits of wint_t. */194#define WINT_MIN INT32_MIN195#define WINT_MAX INT32_MAX196197#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */198199#endif /* !_MACHINE__STDINT_H_ */200201202