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 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
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)
77 typedef signed char int8_t;
79 typedef short int16_t;
85 #if defined(_LONGLONG_TYPE)
87 typedef long long int64_t;
91 typedef unsigned char uint8_t;
92 typedef unsigned short uint16_t;
93 typedef unsigned int uint32_t;
95 typedef unsigned long uint64_t;
97 #if defined(_LONGLONG_TYPE)
98 typedef unsigned long long uint64_t;
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;
110 typedef int32_t intmax_t;
111 typedef uint32_t uintmax_t;
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;
123 typedef int intptr_t;
124 typedef unsigned int uintptr_t;
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;
134 typedef signed char int_fast8_t;
136 typedef int int_fast16_t;
137 typedef int int_fast32_t;
139 typedef long int_fast64_t;
141 #if defined(_LONGLONG_TYPE)
142 typedef long long int_fast64_t;
146 typedef unsigned char uint_fast8_t;
147 typedef unsigned int uint_fast16_t;
148 typedef unsigned int uint_fast32_t;
150 typedef unsigned long uint_fast64_t;
152 #if defined(_LONGLONG_TYPE)
153 typedef unsigned long long uint_fast64_t;
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;
164 typedef signed char int_least8_t;
166 typedef short int_least16_t;
167 typedef int int_least32_t;
169 typedef long int_least64_t;
171 #if defined(_LONGLONG_TYPE)
172 typedef long long int_least64_t;
176 typedef unsigned char uint_least8_t;
177 typedef unsigned short uint_least16_t;
178 typedef unsigned int uint_least32_t;
180 typedef unsigned long uint_least64_t;
182 #if defined(_LONGLONG_TYPE)
183 typedef unsigned long long uint_least64_t;
191 #endif /* _SYS_INT_TYPES_H */