sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
integer-types.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * config/integer-types.h
4 *
5 * FreeType integer types definitions.
6 *
7 * Copyright (C) 1996-2025 by
8 * David Turner, Robert Wilhelm, and Werner Lemberg.
9 *
10 * This file is part of the FreeType project, and may only be used,
11 * modified, and distributed under the terms of the FreeType project
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute
13 * this file you indicate that you have read the license and
14 * understand and accept it fully.
15 *
16 */
21#ifndef FREETYPE_CONFIG_INTEGER_TYPES_H_
22#define FREETYPE_CONFIG_INTEGER_TYPES_H_
23
24FT_BEGIN_HEADER
25
26 /* There are systems (like the Texas Instruments 'C54x) where a `char` */
27 /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */
28 /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */
29 /* is probably unexpected. */
30 /* */
31 /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */
32 /* `char` type. */
33
34#ifndef FT_CHAR_BIT
35#define FT_CHAR_BIT CHAR_BIT
36#endif
37
38#ifndef FT_SIZEOF_INT
39
40 /* The size of an `int` type. */
41#if FT_UINT_MAX == 0xFFFFUL
42#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT )
43#elif FT_UINT_MAX == 0xFFFFFFFFUL
44#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT )
45#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
46#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT )
47#else
48#error "Unsupported size of `int' type!"
49#endif
50
51#endif /* !defined(FT_SIZEOF_INT) */
52
53#ifndef FT_SIZEOF_LONG
54
55 /* The size of a `long` type. A five-byte `long` (as used e.g. on the */
56 /* DM642) is recognized but avoided. */
57#if FT_ULONG_MAX == 0xFFFFFFFFUL
58#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
59#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
60#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )
61#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
62#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT )
63#else
64#error "Unsupported size of `long' type!"
65#endif
66
67#endif /* !defined(FT_SIZEOF_LONG) */
68
69#ifndef FT_SIZEOF_LONG_LONG
70
71 /* The size of a `long long` type if available */
72#if defined( FT_ULLONG_MAX ) && FT_ULLONG_MAX >= 0xFFFFFFFFFFFFFFFFULL
73#define FT_SIZEOF_LONG_LONG ( 64 / FT_CHAR_BIT )
74#else
75#define FT_SIZEOF_LONG_LONG 0
76#endif
77
78#endif /* !defined(FT_SIZEOF_LONG_LONG) */
79
80
81 /**************************************************************************
82 *
83 * @section:
84 * basic_types
85 *
86 */
87
88
89 /**************************************************************************
90 *
91 * @type:
92 * FT_Int16
93 *
94 * @description:
95 * A typedef for a 16bit signed integer type.
96 */
97 typedef signed short FT_Int16;
98
99
100 /**************************************************************************
101 *
102 * @type:
103 * FT_UInt16
104 *
105 * @description:
106 * A typedef for a 16bit unsigned integer type.
107 */
108 typedef unsigned short FT_UInt16;
109
110 /* */
111
112
113 /* this #if 0 ... #endif clause is for documentation purposes */
114#if 0
115
116 /**************************************************************************
117 *
118 * @type:
119 * FT_Int32
120 *
121 * @description:
122 * A typedef for a 32bit signed integer type. The size depends on the
123 * configuration.
124 */
125 typedef signed XXX FT_Int32;
126
127
128 /**************************************************************************
129 *
130 * @type:
131 * FT_UInt32
132 *
133 * A typedef for a 32bit unsigned integer type. The size depends on the
134 * configuration.
135 */
136 typedef unsigned XXX FT_UInt32;
137
138
139 /**************************************************************************
140 *
141 * @type:
142 * FT_Int64
143 *
144 * A typedef for a 64bit signed integer type. The size depends on the
145 * configuration. Only defined if there is real 64bit support;
146 * otherwise, it gets emulated with a structure (if necessary).
147 */
148 typedef signed XXX FT_Int64;
149
150
151 /**************************************************************************
152 *
153 * @type:
154 * FT_UInt64
155 *
156 * A typedef for a 64bit unsigned integer type. The size depends on the
157 * configuration. Only defined if there is real 64bit support;
158 * otherwise, it gets emulated with a structure (if necessary).
159 */
160 typedef unsigned XXX FT_UInt64;
161
162 /* */
163
164#endif
165
166#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )
167
168 typedef signed int FT_Int32;
169 typedef unsigned int FT_UInt32;
170
171#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )
172
173 typedef signed long FT_Int32;
174 typedef unsigned long FT_UInt32;
175
176#else
177#error "no 32bit type found -- please check your configuration files"
178#endif
179
180
181 /* look up an integer type that is at least 32~bits */
182#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )
183
184 typedef int FT_Fast;
185 typedef unsigned int FT_UFast;
186
187#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )
188
189 typedef long FT_Fast;
190 typedef unsigned long FT_UFast;
191
192#endif
193
194
195 /* determine whether we have a 64-bit integer type */
196#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )
197
198#define FT_INT64 long
199#define FT_UINT64 unsigned long
200
201#elif FT_SIZEOF_LONG_LONG >= ( 64 / FT_CHAR_BIT )
202
203#define FT_INT64 long long int
204#define FT_UINT64 unsigned long long int
205
206 /**************************************************************************
207 *
208 * A 64-bit data type may create compilation problems if you compile in
209 * strict ANSI mode. To avoid them, we disable other 64-bit data types if
210 * `__STDC__` is defined. You can however ignore this rule by defining the
211 * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
212 */
213#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
214
215#if defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
216
217 /* this compiler provides the `__int64` type */
218#define FT_INT64 __int64
219#define FT_UINT64 unsigned __int64
220
221#elif defined( __BORLANDC__ ) /* Borland C++ */
222
223 /* XXXX: We should probably check the value of `__BORLANDC__` in order */
224 /* to test the compiler version. */
225
226 /* this compiler provides the `__int64` type */
227#define FT_INT64 __int64
228#define FT_UINT64 unsigned __int64
229
230#elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1100 /* Watcom C++ */
231
232#define FT_INT64 long long int
233#define FT_UINT64 unsigned long long int
234
235#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
236
237#define FT_INT64 long long int
238#define FT_UINT64 unsigned long long int
239
240#elif defined( __GNUC__ )
241
242 /* GCC provides the `long long` type */
243#define FT_INT64 long long int
244#define FT_UINT64 unsigned long long int
245
246#endif /* !__STDC__ */
247
248#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
249
250#ifdef FT_INT64
251
252 typedef FT_INT64 FT_Int64;
253 typedef FT_UINT64 FT_UInt64;
254
255# define FT_INT64_ZERO 0
256
257#else /* !FT_INT64 */
258
259 /* we need to emulate 64-bit data types if none are available */
260
261 typedef struct FT_Int64_
262 {
263 FT_UInt32 lo;
264 FT_UInt32 hi;
265
266 } FT_Int64;
267
268 typedef struct FT_UInt64_
269 {
270 FT_UInt32 lo;
271 FT_UInt32 hi;
272
273 } FT_UInt64;
274
275# define FT_INT64_ZERO { 0, 0 }
276
277#endif /* !FT_INT64 */
278
279FT_END_HEADER
280
281#endif /* FREETYPE_CONFIG_INTEGER_TYPES_H_ */