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