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 2019 Lauri Tirkkonen <lotheac@iki.fi>
24 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
26 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #ifndef _SYS_INT_TYPES_H
31 #define _SYS_INT_TYPES_H
34 * This file, <sys/int_types.h>, is part of the Sun Microsystems implementation
35 * of <inttypes.h> defined in the ISO C standard, ISO/IEC 9899:1999
36 * Programming language - C.
38 * Programs/Modules should not directly include this file. Access to the
39 * types defined in this file should be through the inclusion of one of the
42 * <sys/types.h> Provides only the "_t" types defined in this
43 * file which is a subset of the contents of
44 * <inttypes.h>. (This can be appropriate for
45 * all programs/modules except those claiming
46 * ANSI-C conformance.)
48 * <sys/inttypes.h> Provides the Kernel and Driver appropriate
49 * components of <inttypes.h>.
51 * <inttypes.h> For use by applications.
53 * See these files for more details.
56 #include <sys/feature_tests.h>
59 * Basic / Extended integer types
61 * The following defines the basic fixed-size integer types.
63 * Implementations are free to typedef them to Standard C integer types or
64 * extensions that they support. If an implementation does not support one
65 * of the particular integer data types below, then it should not define the
66 * typedefs and macros corresponding to that data type. Note that int8_t
67 * is not defined in -Xs mode on ISAs for which the ABI specifies "char"
68 * as an unsigned entity because there is no way to define an eight bit
71 #if defined(_CHAR_IS_SIGNED)
74 typedef signed char int8_t;
76 typedef short int16_t;
79 typedef long long int64_t;
81 typedef unsigned char uint8_t;
82 typedef unsigned short uint16_t;
83 typedef unsigned int uint32_t;
84 typedef unsigned long long uint64_t;
87 * intmax_t and uintmax_t are to be the longest (in number of bits) signed
88 * and unsigned integer types supported by the implementation.
90 #if defined(_INT64_TYPE)
91 typedef int64_t intmax_t;
92 typedef uint64_t uintmax_t;
94 typedef int32_t intmax_t;
95 typedef uint32_t uintmax_t;
99 * intptr_t and uintptr_t are signed and unsigned integer types large enough
100 * to hold any data pointer; that is, data pointers can be assigned into or
101 * from these integer types without losing precision.
103 #if defined(_LP64) || defined(_I32LPx)
104 typedef long intptr_t;
105 typedef unsigned long uintptr_t;
107 typedef int intptr_t;
108 typedef unsigned int uintptr_t;
112 * The following define the fastest integer types that can hold the
113 * specified number of bits.
115 #if defined(_CHAR_IS_SIGNED)
116 typedef char int_fast8_t;
118 typedef signed char int_fast8_t;
120 typedef int int_fast16_t;
121 typedef int int_fast32_t;
123 typedef long int_fast64_t;
125 typedef long long int_fast64_t;
128 typedef unsigned char uint_fast8_t;
129 typedef unsigned int uint_fast16_t;
130 typedef unsigned int uint_fast32_t;
132 typedef unsigned long uint_fast64_t;
134 typedef unsigned long long uint_fast64_t;
138 * The following define the smallest integer types that can hold the
139 * specified number of bits.
141 #if defined(_CHAR_IS_SIGNED)
142 typedef char int_least8_t;
144 typedef signed char int_least8_t;
146 typedef short int_least16_t;
147 typedef int int_least32_t;
149 typedef long int_least64_t;
151 typedef long long int_least64_t;
154 typedef unsigned char uint_least8_t;
155 typedef unsigned short uint_least16_t;
156 typedef unsigned int uint_least32_t;
158 typedef unsigned long uint_least64_t;
160 typedef unsigned long long uint_least64_t;
163 #endif /* _SYS_INT_TYPES_H */