int_types.h
1 /*
2 * Copyright (c) 1996 by Sun Microsystems, Inc.
3 * All rights reserved.
4 */
5
6 #ifndef _SYS_INT_TYPES_H
7 #define _SYS_INT_TYPES_H
8
9 #pragma ident "@(#)int_types.h 1.6 97/08/20 SMI"
10
11 /*
12 * This file, , is part of the Sun Microsystems implementation
13 * of as proposed in the ISO/JTC1/SC22/WG14 C committee's working
14 * draft for the revision of the current ISO C standard, ISO/IEC 9899:1990
15 * Programming language - C.
16 *
17 * Programs/Modules should not directly include this file. Access to the
18 * types defined in this file should be through the inclusion of one of the
19 * following files:
20 *
21 * Provides only the "_t" types defined in this
22 * file which is a subset of the contents of
23 * . (This can be appropriate for
24 * all programs/modules except those claiming
25 * ANSI-C conformance.)
26 *
27 * Provides the Kernel and Driver appropriate
28 * components of .
29 *
30 * For use by applications.
31 *
32 * See these files for more details.
33 *
34 * Use at your own risk. As of February 1996, the committee is squarely
35 * behind the fixed sized types; the "least" and "fast" types are still being
36 * discussed. The probability that the "fast" types may be removed before
37 * the standard is finalized is high enough that they are not currently
38 * implemented. The unimplemented "fast" types are of the form
39 * [u]int_fast[0-9]*_t and [u]intfast_t.
40 */
41
42 #include
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 /*
49 * Basic / Extended integer types
50 *
51 * The following defines the basic fixed-size integer types.
52 *
53 * Implementations are free to typedef them to Standard C integer types or
54 * extensions that they support. If an implementation does not support one
55 * of the particular integer data types below, then it should not define the
56 * typedefs and macros corresponding to that data type. Note that int8_t
57 * is not defined in -Xs mode on ISAs for which the ABI specifies "char"
58 * as an unsigned entity because there is not way to defined an eight bit
59 * signed integral.
60 */
61 #if defined(_CHAR_IS_SIGNED)
62 typedef char int8_t; <typedef:int8_t>
63 #else
64 #if defined(__STDC__)
65 typedef signed char int8_t;
66 #endif
67 #endif
68 typedef short int16_t; <typedef:int16_t>
69 typedef int int32_t; <typedef:int32_t>
70 #ifdef _LP64
71 typedef long int64_t;
72 #else /* _ILP32 */
73 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
74 typedef long long int64_t; <typedef:int64_t>
75 #endif
76 #endif
77
78 typedef unsigned char uint8_t; <typedef:uint8_t>
79 typedef unsigned short uint16_t; <typedef:uint16_t>
80 typedef unsigned int uint32_t; <typedef:uint32_t>
81 #ifdef _LP64
82 typedef unsigned long uint64_t;
83 #else /* _ILP32 */
84 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
85 typedef unsigned long long uint64_t; <typedef:uint64_t>
86 #endif
87 #endif
88
89 /*
90 * intmax_t and uintmax_t are to be the longest (in number of bits) signed
91 * and unsigned integer types supported by the implementation.
92 */
93 #if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))
94 typedef int64_t intmax_t; <typedef:intmax_t>
95 typedef uint64_t uintmax_t; <typedef:uintmax_t>
96 #else
97 typedef int32_t intmax_t;
98 typedef uint32_t uintmax_t;
99 #endif
100
101 /*
102 * intptr_t and uintptr_t are signed and unsigned integer types large enough
103 * to hold any data pointer; that is, data pointers can be assigned into or
104 * from these integer types without losing precision.
105 */
106 #if defined(_LP64) || defined(_I32LPx)
107 typedef long intptr_t;
108 typedef unsigned long uintptr_t;
109 #else
110 typedef int intptr_t; <typedef:intptr_t>
111 typedef unsigned int uintptr_t; <typedef:uintptr_t>
112 #endif
113
114 /*
115 * The following define the smallest integer types that can hold the
116 * specified number of bits.
117 */
118 #if defined(_CHAR_IS_SIGNED)
119 typedef char int_least8_t; <typedef:int_least8_t>
120 #else
121 #if defined(__STDC__)
122 typedef signed char int_least8_t;
123 #endif
124 #endif
125 typedef short int_least16_t; <typedef:int_least16_t>
126 typedef int int_least32_t; <typedef:int_least32_t>
127 #ifdef _LP64
128 typedef long int_least64_t;
129 #else /* _ILP32 */
130 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
131 typedef long long int_least64_t; <typedef:int_least64_t>
132 #endif
133 #endif
134
135 typedef unsigned char uint_least8_t; <typedef:uint_least8_t>
136 typedef unsigned short uint_least16_t; <typedef:uint_least16_t>
137 typedef unsigned int uint_least32_t; <typedef:uint_least32_t>
138 #ifdef _LP64
139 typedef unsigned long uint_least64_t;
140 #else /* _ILP32 */
141 #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
142 typedef unsigned long long uint_least64_t; <typedef:uint_least64_t>
143 #endif
144 #endif
145
146 #ifdef __cplusplus
147 }
148 #endif
149
150 #endif /* _SYS_INT_TYPES_H */