docs/how-to-build.md: use proper markup for directory names
[unleashed/tickless.git] / include / sys / int_types.h
blobe57d6f8b757118bd541fe29b2d7ab8be347cad15
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #ifndef _SYS_INT_TYPES_H
30 #define _SYS_INT_TYPES_H
33 * This file, <sys/int_types.h>, is part of the Sun Microsystems implementation
34 * of <inttypes.h> defined in the ISO C standard, ISO/IEC 9899:1999
35 * Programming language - C.
37 * Programs/Modules should not directly include this file. Access to the
38 * types defined in this file should be through the inclusion of one of the
39 * following files:
41 * <sys/types.h> Provides only the "_t" types defined in this
42 * file which is a subset of the contents of
43 * <inttypes.h>. (This can be appropriate for
44 * all programs/modules except those claiming
45 * ANSI-C conformance.)
47 * <sys/inttypes.h> Provides the Kernel and Driver appropriate
48 * components of <inttypes.h>.
50 * <inttypes.h> For use by applications.
52 * See these files for more details.
55 #include <sys/feature_tests.h>
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
62 * Basic / Extended integer types
64 * The following defines the basic fixed-size integer types.
66 * Implementations are free to typedef them to Standard C integer types or
67 * extensions that they support. If an implementation does not support one
68 * of the particular integer data types below, then it should not define the
69 * typedefs and macros corresponding to that data type. Note that int8_t
70 * is not defined in -Xs mode on ISAs for which the ABI specifies "char"
71 * as an unsigned entity because there is no way to define an eight bit
72 * signed integral.
74 #if defined(_CHAR_IS_SIGNED)
75 typedef char int8_t;
76 #else
77 typedef signed char int8_t;
78 #endif
79 typedef short int16_t;
80 typedef int int32_t;
81 #ifdef _LP64
82 #define _INT64_TYPE
83 typedef long int64_t;
84 #else /* _ILP32 */
85 #if defined(_LONGLONG_TYPE)
86 #define _INT64_TYPE
87 typedef long long int64_t;
88 #endif
89 #endif
91 typedef unsigned char uint8_t;
92 typedef unsigned short uint16_t;
93 typedef unsigned int uint32_t;
94 #ifdef _LP64
95 typedef unsigned long uint64_t;
96 #else /* _ILP32 */
97 #if defined(_LONGLONG_TYPE)
98 typedef unsigned long long uint64_t;
99 #endif
100 #endif
103 * intmax_t and uintmax_t are to be the longest (in number of bits) signed
104 * and unsigned integer types supported by the implementation.
106 #if defined(_INT64_TYPE)
107 typedef int64_t intmax_t;
108 typedef uint64_t uintmax_t;
109 #else
110 typedef int32_t intmax_t;
111 typedef uint32_t uintmax_t;
112 #endif
115 * intptr_t and uintptr_t are signed and unsigned integer types large enough
116 * to hold any data pointer; that is, data pointers can be assigned into or
117 * from these integer types without losing precision.
119 #if defined(_LP64) || defined(_I32LPx)
120 typedef long intptr_t;
121 typedef unsigned long uintptr_t;
122 #else
123 typedef int intptr_t;
124 typedef unsigned int uintptr_t;
125 #endif
128 * The following define the fastest integer types that can hold the
129 * specified number of bits.
131 #if defined(_CHAR_IS_SIGNED)
132 typedef char int_fast8_t;
133 #else
134 typedef signed char int_fast8_t;
135 #endif
136 typedef int int_fast16_t;
137 typedef int int_fast32_t;
138 #ifdef _LP64
139 typedef long int_fast64_t;
140 #else /* _ILP32 */
141 #if defined(_LONGLONG_TYPE)
142 typedef long long int_fast64_t;
143 #endif
144 #endif
146 typedef unsigned char uint_fast8_t;
147 typedef unsigned int uint_fast16_t;
148 typedef unsigned int uint_fast32_t;
149 #ifdef _LP64
150 typedef unsigned long uint_fast64_t;
151 #else /* _ILP32 */
152 #if defined(_LONGLONG_TYPE)
153 typedef unsigned long long uint_fast64_t;
154 #endif
155 #endif
158 * The following define the smallest integer types that can hold the
159 * specified number of bits.
161 #if defined(_CHAR_IS_SIGNED)
162 typedef char int_least8_t;
163 #else
164 typedef signed char int_least8_t;
165 #endif
166 typedef short int_least16_t;
167 typedef int int_least32_t;
168 #ifdef _LP64
169 typedef long int_least64_t;
170 #else /* _ILP32 */
171 #if defined(_LONGLONG_TYPE)
172 typedef long long int_least64_t;
173 #endif
174 #endif
176 typedef unsigned char uint_least8_t;
177 typedef unsigned short uint_least16_t;
178 typedef unsigned int uint_least32_t;
179 #ifdef _LP64
180 typedef unsigned long uint_least64_t;
181 #else /* _ILP32 */
182 #if defined(_LONGLONG_TYPE)
183 typedef unsigned long long uint_least64_t;
184 #endif
185 #endif
187 #ifdef __cplusplus
189 #endif
191 #endif /* _SYS_INT_TYPES_H */