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
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]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_INT_TYPES_H
28 #define _SYS_INT_TYPES_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
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
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>
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
74 #if defined(_CHAR_IS_SIGNED)
78 typedef signed char int8_t;
81 typedef short int16_t;
87 #if defined(_LONGLONG_TYPE)
89 typedef long long int64_t;
93 typedef unsigned char uint8_t;
94 typedef unsigned short uint16_t;
95 typedef unsigned int uint32_t;
97 typedef unsigned long uint64_t;
99 #if defined(_LONGLONG_TYPE)
100 typedef unsigned long long uint64_t;
105 * intmax_t and uintmax_t are to be the longest (in number of bits) signed
106 * and unsigned integer types supported by the implementation.
108 #if defined(_INT64_TYPE)
109 typedef int64_t intmax_t;
110 typedef uint64_t uintmax_t;
112 typedef int32_t intmax_t;
113 typedef uint32_t uintmax_t;
117 * intptr_t and uintptr_t are signed and unsigned integer types large enough
118 * to hold any data pointer; that is, data pointers can be assigned into or
119 * from these integer types without losing precision.
121 #if defined(_LP64) || defined(_I32LPx)
122 typedef long intptr_t;
123 typedef unsigned long uintptr_t;
125 typedef int intptr_t;
126 typedef unsigned int uintptr_t;
130 * The following define the fastest integer types that can hold the
131 * specified number of bits.
133 #if defined(_CHAR_IS_SIGNED)
134 typedef char int_fast8_t;
136 #if defined(__STDC__)
137 typedef signed char int_fast8_t;
140 typedef int int_fast16_t;
141 typedef int int_fast32_t;
143 typedef long int_fast64_t;
145 #if defined(_LONGLONG_TYPE)
146 typedef long long int_fast64_t;
150 typedef unsigned char uint_fast8_t;
151 typedef unsigned int uint_fast16_t;
152 typedef unsigned int uint_fast32_t;
154 typedef unsigned long uint_fast64_t;
156 #if defined(_LONGLONG_TYPE)
157 typedef unsigned long long uint_fast64_t;
162 * The following define the smallest integer types that can hold the
163 * specified number of bits.
165 #if defined(_CHAR_IS_SIGNED)
166 typedef char int_least8_t;
168 #if defined(__STDC__)
169 typedef signed char int_least8_t;
172 typedef short int_least16_t;
173 typedef int int_least32_t;
175 typedef long int_least64_t;
177 #if defined(_LONGLONG_TYPE)
178 typedef long long int_least64_t;
182 typedef unsigned char uint_least8_t;
183 typedef unsigned short uint_least16_t;
184 typedef unsigned int uint_least32_t;
186 typedef unsigned long uint_least64_t;
188 #if defined(_LONGLONG_TYPE)
189 typedef unsigned long long uint_least64_t;
197 #endif /* _SYS_INT_TYPES_H */