1 /*- 2 * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> 3 * Copyright (c) 2001 The NetBSD Foundation, Inc. All rights reserved. 4 * Copyright (c) 1990, 1993 The Regents of the University of California. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Klaus Klein. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * 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 THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 #ifndef _CPU_INT_LIMITS_H_ 40 #define _CPU_INT_LIMITS_H_ 41 42 /* 43 * ISO/IEC 9899:1999 44 * 7.18.2.1 Limits of exact-width integer types 45 */ 46 /* Minimum values of exact-width signed integer types. */ 47 #define INT8_MIN (-0x7f-1) 48 #define INT16_MIN (-0x7fff-1) 49 #define INT32_MIN (-0x7fffffff-1) 50 #define INT64_MIN (-0x7fffffffffffffffL-1) 51 52 /* Maximum values of exact-width signed integer types. */ 53 #define INT8_MAX 0x7f 54 #define INT16_MAX 0x7fff 55 #define INT32_MAX 0x7fffffff 56 #define INT64_MAX 0x7fffffffffffffffL 57 58 /* Maximum values of exact-width unsigned integer types. */ 59 #define UINT8_MAX 0xff 60 #define UINT16_MAX 0xffff 61 #define UINT32_MAX 0xffffffffU 62 #define UINT64_MAX 0xffffffffffffffffUL 63 64 /* 65 * ISO/IEC 9899:1999 66 * 7.18.2.4 Limits of integer types capable of holding object pointers 67 */ 68 #define INTPTR_MIN INT64_MIN 69 #define INTPTR_MAX INT64_MAX 70 #define UINTPTR_MAX UINT64_MAX 71 72 /* 73 * ISO/IEC 9899:1999 74 * 7.18.2.5 Limits of greatest-width integer types 75 */ 76 #define INTMAX_MIN INT64_MIN 77 #define INTMAX_MAX INT64_MAX 78 #define UINTMAX_MAX UINT64_MAX 79 80 /* 81 * ISO/IEC 9899:1999 82 * 7.18.3 Limits of other integer types 83 */ 84 /* Limits of ptrdiff_t. */ 85 #define PTRDIFF_MIN INT64_MIN 86 #define PTRDIFF_MAX INT64_MAX 87 88 /* Limits of sig_atomic_t. */ 89 #define SIG_ATOMIC_MIN INT32_MIN 90 #define SIG_ATOMIC_MAX INT32_MAX 91 92 /* Limit of size_t. */ 93 #define SIZE_MAX UINT64_MAX 94 95 /* 96 * ISO/IEC 9899:1999 97 * 7.18.2.2 Limits of minimum-width integer types 98 */ 99 /* Minimum values of minimum-width signed integer types. */ 100 #define INT_LEAST8_MIN INT8_MIN 101 #define INT_LEAST16_MIN INT16_MIN 102 #define INT_LEAST32_MIN INT32_MIN 103 #define INT_LEAST64_MIN INT64_MIN 104 105 /* Maximum values of minimum-width signed integer types. */ 106 #define INT_LEAST8_MAX INT8_MAX 107 #define INT_LEAST16_MAX INT16_MAX 108 #define INT_LEAST32_MAX INT32_MAX 109 #define INT_LEAST64_MAX INT64_MAX 110 111 /* Maximum values of minimum-width unsigned integer types. */ 112 #define UINT_LEAST8_MAX UINT8_MAX 113 #define UINT_LEAST16_MAX UINT16_MAX 114 #define UINT_LEAST32_MAX UINT32_MAX 115 #define UINT_LEAST64_MAX UINT64_MAX 116 117 /* 118 * ISO/IEC 9899:1999 119 * 7.18.2.3 Limits of fastest minimum-width integer types 120 */ 121 /* Minimum values of fastest minimum-width signed integer types. */ 122 #define INT_FAST8_MIN INT32_MIN 123 #define INT_FAST16_MIN INT32_MIN 124 #define INT_FAST32_MIN INT32_MIN 125 #define INT_FAST64_MIN INT64_MIN 126 127 /* Maximum values of fastest minimum-width signed integer types. */ 128 #define INT_FAST8_MAX INT32_MAX 129 #define INT_FAST16_MAX INT32_MAX 130 #define INT_FAST32_MAX INT32_MAX 131 #define INT_FAST64_MAX INT64_MAX 132 133 /* Maximum values of fastest minimum-width unsigned integer types. */ 134 #define UINT_FAST8_MAX UINT32_MAX 135 #define UINT_FAST16_MAX UINT32_MAX 136 #define UINT_FAST32_MAX UINT32_MAX 137 #define UINT_FAST64_MAX UINT64_MAX 138 139 #endif 140