1 | /** @file
|
---|
2 | * IPRT - Types.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef IPRT_INCLUDED_types_h
|
---|
37 | #define IPRT_INCLUDED_types_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <iprt/cdefs.h>
|
---|
43 | #include <iprt/stdint.h>
|
---|
44 | #include <iprt/stdarg.h>
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * Include standard C types.
|
---|
48 | */
|
---|
49 | #if !defined(IPRT_NO_CRT) && !defined(DOXYGEN_RUNNING)
|
---|
50 |
|
---|
51 | # if defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
|
---|
52 | /*
|
---|
53 | * Kludge for xfree86 modules: size_t and other types are redefined.
|
---|
54 | */
|
---|
55 | RT_C_DECLS_BEGIN
|
---|
56 | # include "xf86_ansic.h"
|
---|
57 | # undef NULL
|
---|
58 | RT_C_DECLS_END
|
---|
59 |
|
---|
60 | # elif defined(RT_OS_DARWIN) && defined(KERNEL)
|
---|
61 | /*
|
---|
62 | * Kludge for the darwin kernel:
|
---|
63 | * stddef.h is missing IIRC.
|
---|
64 | */
|
---|
65 | # ifndef _PTRDIFF_T
|
---|
66 | # define _PTRDIFF_T
|
---|
67 | typedef __darwin_ptrdiff_t ptrdiff_t;
|
---|
68 | # endif
|
---|
69 | # include <sys/types.h>
|
---|
70 |
|
---|
71 | # elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
|
---|
72 | # include <sys/param.h>
|
---|
73 | # undef PVM
|
---|
74 | # if __FreeBSD_version < 1200000
|
---|
75 | /*
|
---|
76 | * Kludge for the FreeBSD kernel:
|
---|
77 | * stddef.h and sys/types.h have slightly different offsetof definitions
|
---|
78 | * when compiling in kernel mode. This is just to make GCC shut up.
|
---|
79 | */
|
---|
80 | # ifndef _STDDEF_H_
|
---|
81 | # undef offsetof
|
---|
82 | # endif
|
---|
83 | # include <sys/stddef.h>
|
---|
84 | # ifndef _SYS_TYPES_H_
|
---|
85 | # undef offsetof
|
---|
86 | # endif
|
---|
87 | # include <sys/types.h>
|
---|
88 | # ifndef offsetof
|
---|
89 | # error "offsetof is not defined!"
|
---|
90 | # endif
|
---|
91 | # else
|
---|
92 | # include <sys/stddef.h>
|
---|
93 | # include <sys/types.h>
|
---|
94 | # endif
|
---|
95 |
|
---|
96 | # elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)
|
---|
97 | /*
|
---|
98 | * Kludge for compiling 32-bit code on a 64-bit FreeBSD:
|
---|
99 | * FreeBSD declares uint64_t and int64_t wrong (long unsigned and long int
|
---|
100 | * though they need to be long long unsigned and long long int). These
|
---|
101 | * defines conflict with our declaration in stdint.h. Adding the defines
|
---|
102 | * below omits the definitions in the system header.
|
---|
103 | */
|
---|
104 | # include <stddef.h>
|
---|
105 | # define _UINT64_T_DECLARED
|
---|
106 | # define _INT64_T_DECLARED
|
---|
107 | # define _UINTPTR_T_DECLARED
|
---|
108 | # define _INTPTR_T_DECLARED
|
---|
109 | # include <sys/types.h>
|
---|
110 |
|
---|
111 | # elif defined(RT_OS_NETBSD) && defined(_KERNEL)
|
---|
112 |
|
---|
113 | # include <sys/types.h>
|
---|
114 |
|
---|
115 | /*
|
---|
116 | * Kludge for NetBSD-6.x where the definition of bool in
|
---|
117 | * <sys/types.h> does not check for C++.
|
---|
118 | */
|
---|
119 | # if defined(__cplusplus) && defined(bool)
|
---|
120 | # undef bool
|
---|
121 | # undef true
|
---|
122 | # undef false
|
---|
123 | # endif
|
---|
124 |
|
---|
125 | /*
|
---|
126 | * Kludge for NetBSD-6.x where <sys/types.h> does not define
|
---|
127 | * ptrdiff_t for the kernel code. Note that we don't worry about
|
---|
128 | * redefinition in <stddef.h> since that header doesn't exist for
|
---|
129 | * _KERNEL code.
|
---|
130 | */
|
---|
131 | # ifdef _BSD_PTRDIFF_T_
|
---|
132 | typedef _BSD_PTRDIFF_T_ ptrdiff_t;
|
---|
133 | # endif
|
---|
134 |
|
---|
135 | # elif defined(RT_OS_LINUX) && defined(__KERNEL__)
|
---|
136 | /*
|
---|
137 | * Kludge for the linux kernel:
|
---|
138 | * 1. sys/types.h doesn't mix with the kernel.
|
---|
139 | * 2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
|
---|
140 | * declares false and true as enum values.
|
---|
141 | * 3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
|
---|
142 | * We work around these issues here and nowhere else.
|
---|
143 | */
|
---|
144 | # if defined(__cplusplus)
|
---|
145 | typedef bool _Bool;
|
---|
146 | # endif
|
---|
147 | # define bool linux_bool
|
---|
148 | # define true linux_true
|
---|
149 | # define false linux_false
|
---|
150 | # define uintptr_t linux_uintptr_t
|
---|
151 | # include <linux/version.h>
|
---|
152 | # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
|
---|
153 | # include <generated/autoconf.h>
|
---|
154 | # else
|
---|
155 | # ifndef AUTOCONF_INCLUDED
|
---|
156 | # include <linux/autoconf.h>
|
---|
157 | # endif
|
---|
158 | # endif
|
---|
159 | # include <linux/compiler.h>
|
---|
160 | # if defined(__cplusplus)
|
---|
161 | /*
|
---|
162 | * Starting with 3.3, <linux/compiler-gcc.h> appends 'notrace' (which
|
---|
163 | * expands to __attribute__((no_instrument_function))) to inline,
|
---|
164 | * __inline and __inline__. Revert that.
|
---|
165 | */
|
---|
166 | # undef inline
|
---|
167 | # define inline inline
|
---|
168 | # undef __inline__
|
---|
169 | # define __inline__ __inline__
|
---|
170 | # undef __inline
|
---|
171 | # define __inline __inline
|
---|
172 | # endif
|
---|
173 | # include <linux/types.h>
|
---|
174 | # include <linux/stddef.h>
|
---|
175 | /*
|
---|
176 | * Starting with 3.4, <linux/stddef.h> defines NULL as '((void*)0)' which
|
---|
177 | * does not work for C++ code.
|
---|
178 | */
|
---|
179 | # undef NULL
|
---|
180 | # undef uintptr_t
|
---|
181 | # ifdef __GNUC__
|
---|
182 | # if !RT_GNUC_PREREQ(4, 1)
|
---|
183 | /*
|
---|
184 | * <linux/compiler-gcc{3,4}.h> does
|
---|
185 | * #define __inline__ __inline__ __attribute__((always_inline))
|
---|
186 | * in some older Linux kernels. Forcing inlining will fail for some RTStrA*
|
---|
187 | * functions with gcc <= 4.0 due to passing variable argument lists.
|
---|
188 | */
|
---|
189 | # undef __inline__
|
---|
190 | # define __inline__ __inline__
|
---|
191 | # endif
|
---|
192 | # endif
|
---|
193 | # undef false
|
---|
194 | # undef true
|
---|
195 | # undef bool
|
---|
196 |
|
---|
197 | # elif !defined(DOXYGEN_RUNNING) && RT_MSC_PREREQ(RT_MSC_VER_VC140) && defined(RT_OS_AGNOSTIC)
|
---|
198 | /* Try avoid needing the UCRT just for stddef.h and sys/types.h. */
|
---|
199 | /** @todo refine the RT_OS_AGNOSTIC test? */
|
---|
200 | # include <vcruntime.h>
|
---|
201 |
|
---|
202 | # else
|
---|
203 | # include <stddef.h>
|
---|
204 | # include <sys/types.h>
|
---|
205 | # endif
|
---|
206 |
|
---|
207 |
|
---|
208 | /* Define any types missing from sys/types.h on Windows and OS/2. */
|
---|
209 | # ifdef _MSC_VER
|
---|
210 | # undef ssize_t
|
---|
211 | typedef intptr_t ssize_t;
|
---|
212 | # endif
|
---|
213 | # if defined(RT_OS_OS2) && (defined(__IBMC__) || defined(__IBMCPP__))
|
---|
214 | typedef signed long ssize_t;
|
---|
215 | # endif
|
---|
216 |
|
---|
217 | #else /* no crt */
|
---|
218 | # include <iprt/nocrt/compiler/compiler.h>
|
---|
219 | #endif /* no crt */
|
---|
220 |
|
---|
221 |
|
---|
222 |
|
---|
223 | /** @def NULL
|
---|
224 | * NULL pointer.
|
---|
225 | */
|
---|
226 | #ifndef NULL
|
---|
227 | # ifdef __cplusplus
|
---|
228 | # define NULL 0
|
---|
229 | # else
|
---|
230 | # define NULL ((void*)0)
|
---|
231 | # endif
|
---|
232 | #endif
|
---|
233 |
|
---|
234 |
|
---|
235 |
|
---|
236 | /** @defgroup grp_rt_types IPRT Base Types
|
---|
237 | * @{
|
---|
238 | */
|
---|
239 |
|
---|
240 | /* define wchar_t, we don't wanna include all the wcsstuff to get this. */
|
---|
241 | #ifdef _MSC_VER
|
---|
242 | # ifndef _WCHAR_T_DEFINED
|
---|
243 | typedef unsigned short wchar_t;
|
---|
244 | # define _WCHAR_T_DEFINED
|
---|
245 | # endif
|
---|
246 | #endif
|
---|
247 | #ifdef __GNUC__
|
---|
248 | /** @todo wchar_t on GNUC */
|
---|
249 | #endif
|
---|
250 |
|
---|
251 | /*
|
---|
252 | * C doesn't have bool, nor does VisualAge for C++ v3.08.
|
---|
253 | */
|
---|
254 | #if !defined(__cplusplus) || (defined(__IBMCPP__) && defined(RT_OS_OS2))
|
---|
255 | # if defined(__GNUC__)
|
---|
256 | # if defined(RT_OS_LINUX) && __GNUC__ < 3
|
---|
257 | typedef uint8_t bool;
|
---|
258 | # elif defined(RT_OS_FREEBSD)
|
---|
259 | # ifndef __bool_true_false_are_defined
|
---|
260 | typedef _Bool bool;
|
---|
261 | # endif
|
---|
262 | # elif defined(RT_OS_NETBSD)
|
---|
263 | # if !defined(_KERNEL)
|
---|
264 | /*
|
---|
265 | * For the kernel code <stdbool.h> is not available, but bool is
|
---|
266 | * provided by <sys/types.h> included above.
|
---|
267 | */
|
---|
268 | # include <stdbool.h>
|
---|
269 |
|
---|
270 | /*
|
---|
271 | * ... but the story doesn't end here. The C standard says that
|
---|
272 | * <stdbool.h> defines preprocessor macro "bool" that expands to
|
---|
273 | * "_Bool", but adds that a program may undefine/redefine it
|
---|
274 | * (this is 7.16 in C99 and 7.18 in C11). We have to play this
|
---|
275 | * game here because X11 code uses "bool" as a struct member name
|
---|
276 | * - so undefine "bool" and provide it as a typedef instead. We
|
---|
277 | * still keep #include <stdbool.h> so that any code that might
|
---|
278 | * include it later doesn't mess things up.
|
---|
279 | */
|
---|
280 | # undef bool
|
---|
281 | typedef _Bool bool;
|
---|
282 | # endif
|
---|
283 | # else
|
---|
284 | # undef bool /* see above netbsd explanation */
|
---|
285 | typedef _Bool bool;
|
---|
286 | # endif
|
---|
287 | # else
|
---|
288 | # if RT_MSC_PREREQ(RT_MSC_VER_VC120)
|
---|
289 | # include <stdbool.h>
|
---|
290 | # else
|
---|
291 | typedef unsigned char bool;
|
---|
292 | # endif
|
---|
293 | # endif
|
---|
294 | # ifndef true
|
---|
295 | # define true (1)
|
---|
296 | # endif
|
---|
297 | # ifndef false
|
---|
298 | # define false (0)
|
---|
299 | # endif
|
---|
300 | #endif
|
---|
301 |
|
---|
302 |
|
---|
303 | /**
|
---|
304 | * 128-bit unsigned integer.
|
---|
305 | */
|
---|
306 | #ifdef RT_COMPILER_WITH_128BIT_INT_TYPES
|
---|
307 | typedef __uint128_t uint128_t;
|
---|
308 | #else
|
---|
309 | typedef struct uint128_s
|
---|
310 | {
|
---|
311 | # ifdef RT_BIG_ENDIAN
|
---|
312 | uint64_t Hi;
|
---|
313 | uint64_t Lo;
|
---|
314 | # else
|
---|
315 | uint64_t Lo;
|
---|
316 | uint64_t Hi;
|
---|
317 | # endif
|
---|
318 | } uint128_t;
|
---|
319 | #endif
|
---|
320 |
|
---|
321 |
|
---|
322 | /**
|
---|
323 | * 128-bit signed integer.
|
---|
324 | */
|
---|
325 | #ifdef RT_COMPILER_WITH_128BIT_INT_TYPES
|
---|
326 | typedef __int128_t int128_t;
|
---|
327 | #else
|
---|
328 | typedef struct int128_s
|
---|
329 | {
|
---|
330 | # ifdef RT_BIG_ENDIAN
|
---|
331 | int64_t Hi;
|
---|
332 | uint64_t Lo;
|
---|
333 | # else
|
---|
334 | uint64_t Lo;
|
---|
335 | int64_t Hi;
|
---|
336 | # endif
|
---|
337 | } int128_t;
|
---|
338 | #endif
|
---|
339 |
|
---|
340 |
|
---|
341 | /**
|
---|
342 | * 16-bit unsigned integer union.
|
---|
343 | */
|
---|
344 | typedef union RTUINT16U
|
---|
345 | {
|
---|
346 | /** natural view. */
|
---|
347 | uint16_t u;
|
---|
348 |
|
---|
349 | /** 16-bit hi/lo view. */
|
---|
350 | struct
|
---|
351 | {
|
---|
352 | #ifdef RT_BIG_ENDIAN
|
---|
353 | uint8_t Hi;
|
---|
354 | uint8_t Lo;
|
---|
355 | #else
|
---|
356 | uint8_t Lo;
|
---|
357 | uint8_t Hi;
|
---|
358 | #endif
|
---|
359 | } s;
|
---|
360 |
|
---|
361 | /** Unsigned 16-bit view. */
|
---|
362 | uint16_t au16[1];
|
---|
363 | /** Unsigned 8-bit view. */
|
---|
364 | uint8_t au8[2];
|
---|
365 |
|
---|
366 | /** Signed 16-bit view. */
|
---|
367 | int16_t ai16[1];
|
---|
368 | /** Signed 8-bit view. */
|
---|
369 | int8_t ai8[2];
|
---|
370 | } RTUINT16U;
|
---|
371 | /** Pointer to a 16-bit unsigned integer union. */
|
---|
372 | typedef RTUINT16U RT_FAR *PRTUINT16U;
|
---|
373 | /** Pointer to a const 32-bit unsigned integer union. */
|
---|
374 | typedef const RTUINT16U RT_FAR *PCRTUINT16U;
|
---|
375 |
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * 32-bit unsigned integer union.
|
---|
379 | */
|
---|
380 | typedef union RTUINT32U
|
---|
381 | {
|
---|
382 | /** natural view. */
|
---|
383 | uint32_t u;
|
---|
384 | /** Hi/Low view. */
|
---|
385 | struct
|
---|
386 | {
|
---|
387 | #ifdef RT_BIG_ENDIAN
|
---|
388 | uint16_t Hi;
|
---|
389 | uint16_t Lo;
|
---|
390 | #else
|
---|
391 | uint16_t Lo;
|
---|
392 | uint16_t Hi;
|
---|
393 | #endif
|
---|
394 | } s;
|
---|
395 | /** Word view. */
|
---|
396 | struct
|
---|
397 | {
|
---|
398 | #ifdef RT_BIG_ENDIAN
|
---|
399 | uint16_t w1;
|
---|
400 | uint16_t w0;
|
---|
401 | #else
|
---|
402 | uint16_t w0;
|
---|
403 | uint16_t w1;
|
---|
404 | #endif
|
---|
405 | } Words;
|
---|
406 |
|
---|
407 | /** Unsigned 32-bit view. */
|
---|
408 | uint32_t au32[1];
|
---|
409 | /** Unsigned 16-bit view. */
|
---|
410 | uint16_t au16[2];
|
---|
411 | /** Unsigned 8-bit view. */
|
---|
412 | uint8_t au8[4];
|
---|
413 |
|
---|
414 | /** Signed 32-bit view. */
|
---|
415 | int32_t ai32[1];
|
---|
416 | /** Signed 16-bit view. */
|
---|
417 | int16_t ai16[2];
|
---|
418 | /** Signed 8-bit view. */
|
---|
419 | int8_t ai8[4];
|
---|
420 | } RTUINT32U;
|
---|
421 | /** Pointer to a 32-bit unsigned integer union. */
|
---|
422 | typedef RTUINT32U RT_FAR *PRTUINT32U;
|
---|
423 | /** Pointer to a const 32-bit unsigned integer union. */
|
---|
424 | typedef const RTUINT32U RT_FAR *PCRTUINT32U;
|
---|
425 |
|
---|
426 |
|
---|
427 | /**
|
---|
428 | * 64-bit unsigned integer union.
|
---|
429 | */
|
---|
430 | typedef union RTUINT64U
|
---|
431 | {
|
---|
432 | /** Natural view. */
|
---|
433 | uint64_t u;
|
---|
434 | /** Hi/Low view. */
|
---|
435 | struct
|
---|
436 | {
|
---|
437 | #ifdef RT_BIG_ENDIAN
|
---|
438 | uint32_t Hi;
|
---|
439 | uint32_t Lo;
|
---|
440 | #else
|
---|
441 | uint32_t Lo;
|
---|
442 | uint32_t Hi;
|
---|
443 | #endif
|
---|
444 | } s;
|
---|
445 | /** Double-Word view. */
|
---|
446 | struct
|
---|
447 | {
|
---|
448 | #ifdef RT_BIG_ENDIAN
|
---|
449 | uint32_t dw1;
|
---|
450 | uint32_t dw0;
|
---|
451 | #else
|
---|
452 | uint32_t dw0;
|
---|
453 | uint32_t dw1;
|
---|
454 | #endif
|
---|
455 | } DWords;
|
---|
456 | /** Word view. */
|
---|
457 | struct
|
---|
458 | {
|
---|
459 | #ifdef RT_BIG_ENDIAN
|
---|
460 | uint16_t w3;
|
---|
461 | uint16_t w2;
|
---|
462 | uint16_t w1;
|
---|
463 | uint16_t w0;
|
---|
464 | #else
|
---|
465 | uint16_t w0;
|
---|
466 | uint16_t w1;
|
---|
467 | uint16_t w2;
|
---|
468 | uint16_t w3;
|
---|
469 | #endif
|
---|
470 | } Words;
|
---|
471 |
|
---|
472 | /** Unsigned 64-bit view. */
|
---|
473 | uint64_t au64[1];
|
---|
474 | /** Unsigned 32-bit view. */
|
---|
475 | uint32_t au32[2];
|
---|
476 | /** Unsigned 16-bit view. */
|
---|
477 | uint16_t au16[4];
|
---|
478 | /** Unsigned 8-bit view. */
|
---|
479 | uint8_t au8[8];
|
---|
480 |
|
---|
481 | /** Signed 64-bit view. */
|
---|
482 | int64_t ai64[1];
|
---|
483 | /** Signed 32-bit view. */
|
---|
484 | int32_t ai32[2];
|
---|
485 | /** Signed 16-bit view. */
|
---|
486 | int16_t ai16[4];
|
---|
487 | /** Signed 8-bit view. */
|
---|
488 | int8_t ai8[8];
|
---|
489 | } RTUINT64U;
|
---|
490 | /** Pointer to a 64-bit unsigned integer union. */
|
---|
491 | typedef RTUINT64U RT_FAR *PRTUINT64U;
|
---|
492 | /** Pointer to a const 64-bit unsigned integer union. */
|
---|
493 | typedef const RTUINT64U RT_FAR *PCRTUINT64U;
|
---|
494 |
|
---|
495 |
|
---|
496 | /**
|
---|
497 | * 128-bit unsigned integer union.
|
---|
498 | */
|
---|
499 | #pragma pack(1)
|
---|
500 | typedef union RTUINT128U
|
---|
501 | {
|
---|
502 | /** Hi/Low view.
|
---|
503 | * @remarks We put this first so we can have portable initializers
|
---|
504 | * (RTUINT128_INIT) */
|
---|
505 | struct
|
---|
506 | {
|
---|
507 | #ifdef RT_BIG_ENDIAN
|
---|
508 | uint64_t Hi;
|
---|
509 | uint64_t Lo;
|
---|
510 | #else
|
---|
511 | uint64_t Lo;
|
---|
512 | uint64_t Hi;
|
---|
513 | #endif
|
---|
514 | } s;
|
---|
515 |
|
---|
516 | /** Natural view.
|
---|
517 | * WARNING! This member depends on the compiler supporting 128-bit stuff. */
|
---|
518 | uint128_t u;
|
---|
519 |
|
---|
520 | /** Quad-Word view. */
|
---|
521 | struct
|
---|
522 | {
|
---|
523 | #ifdef RT_BIG_ENDIAN
|
---|
524 | uint64_t qw1;
|
---|
525 | uint64_t qw0;
|
---|
526 | #else
|
---|
527 | uint64_t qw0;
|
---|
528 | uint64_t qw1;
|
---|
529 | #endif
|
---|
530 | } QWords;
|
---|
531 | /** Double-Word view. */
|
---|
532 | struct
|
---|
533 | {
|
---|
534 | #ifdef RT_BIG_ENDIAN
|
---|
535 | uint32_t dw3;
|
---|
536 | uint32_t dw2;
|
---|
537 | uint32_t dw1;
|
---|
538 | uint32_t dw0;
|
---|
539 | #else
|
---|
540 | uint32_t dw0;
|
---|
541 | uint32_t dw1;
|
---|
542 | uint32_t dw2;
|
---|
543 | uint32_t dw3;
|
---|
544 | #endif
|
---|
545 | } DWords;
|
---|
546 | /** Word view. */
|
---|
547 | struct
|
---|
548 | {
|
---|
549 | #ifdef RT_BIG_ENDIAN
|
---|
550 | uint16_t w7;
|
---|
551 | uint16_t w6;
|
---|
552 | uint16_t w5;
|
---|
553 | uint16_t w4;
|
---|
554 | uint16_t w3;
|
---|
555 | uint16_t w2;
|
---|
556 | uint16_t w1;
|
---|
557 | uint16_t w0;
|
---|
558 | #else
|
---|
559 | uint16_t w0;
|
---|
560 | uint16_t w1;
|
---|
561 | uint16_t w2;
|
---|
562 | uint16_t w3;
|
---|
563 | uint16_t w4;
|
---|
564 | uint16_t w5;
|
---|
565 | uint16_t w6;
|
---|
566 | uint16_t w7;
|
---|
567 | #endif
|
---|
568 | } Words;
|
---|
569 |
|
---|
570 | /** Unsigned 64-bit view. */
|
---|
571 | uint64_t au64[2];
|
---|
572 | /** Unsigned 32-bit view. */
|
---|
573 | uint32_t au32[4];
|
---|
574 | /** Unsigned 16-bit view. */
|
---|
575 | uint16_t au16[8];
|
---|
576 | /** Unsigned 8-bit view. */
|
---|
577 | uint8_t au8[16];
|
---|
578 |
|
---|
579 | /** Signed 64-bit view. */
|
---|
580 | int64_t ai64[2];
|
---|
581 | /** Signed 32-bit view. */
|
---|
582 | int32_t ai32[4];
|
---|
583 | /** Signed 16-bit view. */
|
---|
584 | int16_t ai16[8];
|
---|
585 | /** Signed 8-bit view. */
|
---|
586 | int8_t ai8[16];
|
---|
587 | } RTUINT128U;
|
---|
588 | #pragma pack()
|
---|
589 | /** Pointer to a 128-bit unsigned integer union. */
|
---|
590 | typedef RTUINT128U RT_FAR *PRTUINT128U;
|
---|
591 | /** Pointer to a const 128-bit unsigned integer union. */
|
---|
592 | typedef const RTUINT128U RT_FAR *PCRTUINT128U;
|
---|
593 |
|
---|
594 | /** @def RTUINT128_INIT
|
---|
595 | * Portable RTUINT128U initializer. */
|
---|
596 | #ifdef RT_BIG_ENDIAN
|
---|
597 | # define RTUINT128_INIT(a_Hi, a_Lo) { { a_Hi, a_Lo } }
|
---|
598 | #else
|
---|
599 | # define RTUINT128_INIT(a_Hi, a_Lo) { { a_Lo, a_Hi } }
|
---|
600 | #endif
|
---|
601 |
|
---|
602 | /** @def RTUINT128_INIT_C
|
---|
603 | * Portable RTUINT128U initializer for 64-bit constants. */
|
---|
604 | #ifdef RT_BIG_ENDIAN
|
---|
605 | # define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Hi), UINT64_C(a_Lo) } }
|
---|
606 | #else
|
---|
607 | # define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Lo), UINT64_C(a_Hi) } }
|
---|
608 | #endif
|
---|
609 |
|
---|
610 |
|
---|
611 | /**
|
---|
612 | * 256-bit unsigned integer union.
|
---|
613 | */
|
---|
614 | #pragma pack(1)
|
---|
615 | typedef union RTUINT256U
|
---|
616 | {
|
---|
617 | /** Quad-Word view (first as it's used by RTUINT256_INIT). */
|
---|
618 | struct
|
---|
619 | {
|
---|
620 | #ifdef RT_BIG_ENDIAN
|
---|
621 | uint64_t qw3;
|
---|
622 | uint64_t qw2;
|
---|
623 | uint64_t qw1;
|
---|
624 | uint64_t qw0;
|
---|
625 | #else
|
---|
626 | uint64_t qw0;
|
---|
627 | uint64_t qw1;
|
---|
628 | uint64_t qw2;
|
---|
629 | uint64_t qw3;
|
---|
630 | #endif
|
---|
631 | } QWords;
|
---|
632 | /** Double-Word view. */
|
---|
633 | struct
|
---|
634 | {
|
---|
635 | #ifdef RT_BIG_ENDIAN
|
---|
636 | uint32_t dw7;
|
---|
637 | uint32_t dw6;
|
---|
638 | uint32_t dw5;
|
---|
639 | uint32_t dw4;
|
---|
640 | uint32_t dw3;
|
---|
641 | uint32_t dw2;
|
---|
642 | uint32_t dw1;
|
---|
643 | uint32_t dw0;
|
---|
644 | #else
|
---|
645 | uint32_t dw0;
|
---|
646 | uint32_t dw1;
|
---|
647 | uint32_t dw2;
|
---|
648 | uint32_t dw3;
|
---|
649 | uint32_t dw4;
|
---|
650 | uint32_t dw5;
|
---|
651 | uint32_t dw6;
|
---|
652 | uint32_t dw7;
|
---|
653 | #endif
|
---|
654 | } DWords;
|
---|
655 | /** Word view. */
|
---|
656 | struct
|
---|
657 | {
|
---|
658 | #ifdef RT_BIG_ENDIAN
|
---|
659 | uint16_t w15;
|
---|
660 | uint16_t w14;
|
---|
661 | uint16_t w13;
|
---|
662 | uint16_t w12;
|
---|
663 | uint16_t w11;
|
---|
664 | uint16_t w10;
|
---|
665 | uint16_t w9;
|
---|
666 | uint16_t w8;
|
---|
667 | uint16_t w7;
|
---|
668 | uint16_t w6;
|
---|
669 | uint16_t w5;
|
---|
670 | uint16_t w4;
|
---|
671 | uint16_t w3;
|
---|
672 | uint16_t w2;
|
---|
673 | uint16_t w1;
|
---|
674 | uint16_t w0;
|
---|
675 | #else
|
---|
676 | uint16_t w0;
|
---|
677 | uint16_t w1;
|
---|
678 | uint16_t w2;
|
---|
679 | uint16_t w3;
|
---|
680 | uint16_t w4;
|
---|
681 | uint16_t w5;
|
---|
682 | uint16_t w6;
|
---|
683 | uint16_t w7;
|
---|
684 | uint16_t w8;
|
---|
685 | uint16_t w9;
|
---|
686 | uint16_t w10;
|
---|
687 | uint16_t w11;
|
---|
688 | uint16_t w12;
|
---|
689 | uint16_t w13;
|
---|
690 | uint16_t w14;
|
---|
691 | uint16_t w15;
|
---|
692 | #endif
|
---|
693 | } Words;
|
---|
694 |
|
---|
695 | /** Double-Quad-Word view. */
|
---|
696 | struct
|
---|
697 | {
|
---|
698 | #ifdef RT_BIG_ENDIAN
|
---|
699 | RTUINT128U dqw1;
|
---|
700 | RTUINT128U dqw0;
|
---|
701 | #else
|
---|
702 | RTUINT128U dqw0;
|
---|
703 | RTUINT128U dqw1;
|
---|
704 | #endif
|
---|
705 | } DQWords;
|
---|
706 |
|
---|
707 | /** Unsigned 128-bit view. */
|
---|
708 | RTUINT128U au128[2];
|
---|
709 | /** Unsigned 64-bit view. */
|
---|
710 | uint64_t au64[4];
|
---|
711 | /** Unsigned 32-bit view. */
|
---|
712 | uint32_t au32[8];
|
---|
713 | /** Unsigned 16-bit view. */
|
---|
714 | uint16_t au16[16];
|
---|
715 | /** Unsigned 8-bit view. */
|
---|
716 | uint8_t au8[32];
|
---|
717 |
|
---|
718 | /** Signed 64-bit view. */
|
---|
719 | int64_t ai64[4];
|
---|
720 | /** Signed 32-bit view. */
|
---|
721 | int32_t ai32[8];
|
---|
722 | /** Signed 16-bit view. */
|
---|
723 | int16_t ai16[16];
|
---|
724 | /** Signed 8-bit view. */
|
---|
725 | int8_t ai8[32];
|
---|
726 | } RTUINT256U;
|
---|
727 | #pragma pack()
|
---|
728 | /** Pointer to a 256-bit unsigned integer union. */
|
---|
729 | typedef RTUINT256U RT_FAR *PRTUINT256U;
|
---|
730 | /** Pointer to a const 256-bit unsigned integer union. */
|
---|
731 | typedef const RTUINT256U RT_FAR *PCRTUINT256U;
|
---|
732 |
|
---|
733 | /** @def RTUINT256_INIT
|
---|
734 | * Portable RTUINT256U initializer. */
|
---|
735 | #ifdef RT_BIG_ENDIAN
|
---|
736 | # define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw3, a_Qw2, a_Qw1, a_Qw0 } }
|
---|
737 | #else
|
---|
738 | # define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw0, a_Qw1, a_Qw2, a_Qw3 } }
|
---|
739 | #endif
|
---|
740 |
|
---|
741 | /** @def RTUINT256_INIT_C
|
---|
742 | * Portable RTUINT256U initializer for 64-bit constants. */
|
---|
743 | #define RTUINT256_INIT_C(a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
|
---|
744 | RTUINT256_INIT(UINT64_C(a_Qw3), UINT64_C(a_Qw2), UINT64_C(a_Qw1), UINT64_C(a_Qw0))
|
---|
745 |
|
---|
746 |
|
---|
747 | /**
|
---|
748 | * 512-bit unsigned integer union.
|
---|
749 | */
|
---|
750 | #pragma pack(1)
|
---|
751 | typedef union RTUINT512U
|
---|
752 | {
|
---|
753 | /** Quad-Word view (first as it's used by RTUINT512_INIT). */
|
---|
754 | struct
|
---|
755 | {
|
---|
756 | #ifdef RT_BIG_ENDIAN
|
---|
757 | uint64_t qw7;
|
---|
758 | uint64_t qw6;
|
---|
759 | uint64_t qw5;
|
---|
760 | uint64_t qw4;
|
---|
761 | uint64_t qw3;
|
---|
762 | uint64_t qw2;
|
---|
763 | uint64_t qw1;
|
---|
764 | uint64_t qw0;
|
---|
765 | #else
|
---|
766 | uint64_t qw0;
|
---|
767 | uint64_t qw1;
|
---|
768 | uint64_t qw2;
|
---|
769 | uint64_t qw3;
|
---|
770 | uint64_t qw4;
|
---|
771 | uint64_t qw5;
|
---|
772 | uint64_t qw6;
|
---|
773 | uint64_t qw7;
|
---|
774 | #endif
|
---|
775 | } QWords;
|
---|
776 | /** Double-Word view. */
|
---|
777 | struct
|
---|
778 | {
|
---|
779 | #ifdef RT_BIG_ENDIAN
|
---|
780 | uint32_t dw15;
|
---|
781 | uint32_t dw14;
|
---|
782 | uint32_t dw13;
|
---|
783 | uint32_t dw12;
|
---|
784 | uint32_t dw11;
|
---|
785 | uint32_t dw10;
|
---|
786 | uint32_t dw9;
|
---|
787 | uint32_t dw8;
|
---|
788 | uint32_t dw7;
|
---|
789 | uint32_t dw6;
|
---|
790 | uint32_t dw5;
|
---|
791 | uint32_t dw4;
|
---|
792 | uint32_t dw3;
|
---|
793 | uint32_t dw2;
|
---|
794 | uint32_t dw1;
|
---|
795 | uint32_t dw0;
|
---|
796 | #else
|
---|
797 | uint32_t dw0;
|
---|
798 | uint32_t dw1;
|
---|
799 | uint32_t dw2;
|
---|
800 | uint32_t dw3;
|
---|
801 | uint32_t dw4;
|
---|
802 | uint32_t dw5;
|
---|
803 | uint32_t dw6;
|
---|
804 | uint32_t dw7;
|
---|
805 | uint32_t dw8;
|
---|
806 | uint32_t dw9;
|
---|
807 | uint32_t dw10;
|
---|
808 | uint32_t dw11;
|
---|
809 | uint32_t dw12;
|
---|
810 | uint32_t dw13;
|
---|
811 | uint32_t dw14;
|
---|
812 | uint32_t dw15;
|
---|
813 | #endif
|
---|
814 | } DWords;
|
---|
815 | /** Word view. */
|
---|
816 | struct
|
---|
817 | {
|
---|
818 | #ifdef RT_BIG_ENDIAN
|
---|
819 | uint16_t w31;
|
---|
820 | uint16_t w30;
|
---|
821 | uint16_t w29;
|
---|
822 | uint16_t w28;
|
---|
823 | uint16_t w27;
|
---|
824 | uint16_t w26;
|
---|
825 | uint16_t w25;
|
---|
826 | uint16_t w24;
|
---|
827 | uint16_t w23;
|
---|
828 | uint16_t w22;
|
---|
829 | uint16_t w21;
|
---|
830 | uint16_t w20;
|
---|
831 | uint16_t w19;
|
---|
832 | uint16_t w18;
|
---|
833 | uint16_t w17;
|
---|
834 | uint16_t w16;
|
---|
835 | uint16_t w15;
|
---|
836 | uint16_t w14;
|
---|
837 | uint16_t w13;
|
---|
838 | uint16_t w12;
|
---|
839 | uint16_t w11;
|
---|
840 | uint16_t w10;
|
---|
841 | uint16_t w9;
|
---|
842 | uint16_t w8;
|
---|
843 | uint16_t w7;
|
---|
844 | uint16_t w6;
|
---|
845 | uint16_t w5;
|
---|
846 | uint16_t w4;
|
---|
847 | uint16_t w3;
|
---|
848 | uint16_t w2;
|
---|
849 | uint16_t w1;
|
---|
850 | uint16_t w0;
|
---|
851 | #else
|
---|
852 | uint16_t w0;
|
---|
853 | uint16_t w1;
|
---|
854 | uint16_t w2;
|
---|
855 | uint16_t w3;
|
---|
856 | uint16_t w4;
|
---|
857 | uint16_t w5;
|
---|
858 | uint16_t w6;
|
---|
859 | uint16_t w7;
|
---|
860 | uint16_t w8;
|
---|
861 | uint16_t w9;
|
---|
862 | uint16_t w10;
|
---|
863 | uint16_t w11;
|
---|
864 | uint16_t w12;
|
---|
865 | uint16_t w13;
|
---|
866 | uint16_t w14;
|
---|
867 | uint16_t w15;
|
---|
868 | uint16_t w16;
|
---|
869 | uint16_t w17;
|
---|
870 | uint16_t w18;
|
---|
871 | uint16_t w19;
|
---|
872 | uint16_t w20;
|
---|
873 | uint16_t w21;
|
---|
874 | uint16_t w22;
|
---|
875 | uint16_t w23;
|
---|
876 | uint16_t w24;
|
---|
877 | uint16_t w25;
|
---|
878 | uint16_t w26;
|
---|
879 | uint16_t w27;
|
---|
880 | uint16_t w28;
|
---|
881 | uint16_t w29;
|
---|
882 | uint16_t w30;
|
---|
883 | uint16_t w31;
|
---|
884 | #endif
|
---|
885 | } Words;
|
---|
886 |
|
---|
887 | /** Double-Quad-Word view. */
|
---|
888 | struct
|
---|
889 | {
|
---|
890 | #ifdef RT_BIG_ENDIAN
|
---|
891 | RTUINT128U dqw3;
|
---|
892 | RTUINT128U dqw2;
|
---|
893 | RTUINT128U dqw1;
|
---|
894 | RTUINT128U dqw0;
|
---|
895 | #else
|
---|
896 | RTUINT128U dqw0;
|
---|
897 | RTUINT128U dqw1;
|
---|
898 | RTUINT128U dqw2;
|
---|
899 | RTUINT128U dqw3;
|
---|
900 | #endif
|
---|
901 | } DQWords;
|
---|
902 |
|
---|
903 | /** Octo-Word view. */
|
---|
904 | struct
|
---|
905 | {
|
---|
906 | #ifdef RT_BIG_ENDIAN
|
---|
907 | RTUINT256U ow3;
|
---|
908 | RTUINT256U ow2;
|
---|
909 | RTUINT256U ow1;
|
---|
910 | RTUINT256U ow0;
|
---|
911 | #else
|
---|
912 | RTUINT256U ow0;
|
---|
913 | RTUINT256U ow1;
|
---|
914 | RTUINT256U ow2;
|
---|
915 | RTUINT256U ow3;
|
---|
916 | #endif
|
---|
917 | } OWords;
|
---|
918 |
|
---|
919 | /** 256-bit view. */
|
---|
920 | RTUINT256U au256[2];
|
---|
921 | /** 128-bit view. */
|
---|
922 | RTUINT128U au128[4];
|
---|
923 | /** 64-bit view. */
|
---|
924 | uint64_t au64[8];
|
---|
925 | /** 32-bit view. */
|
---|
926 | uint32_t au32[16];
|
---|
927 | /** 16-bit view. */
|
---|
928 | uint16_t au16[32];
|
---|
929 | /** 8-bit view. */
|
---|
930 | uint8_t au8[64];
|
---|
931 | } RTUINT512U;
|
---|
932 | #pragma pack()
|
---|
933 | /** Pointer to a 512-bit unsigned integer union. */
|
---|
934 | typedef RTUINT512U RT_FAR *PRTUINT512U;
|
---|
935 | /** Pointer to a const 512-bit unsigned integer union. */
|
---|
936 | typedef const RTUINT512U RT_FAR *PCRTUINT512U;
|
---|
937 |
|
---|
938 | /** @def RTUINT512_INIT
|
---|
939 | * Portable RTUINT512U initializer. */
|
---|
940 | #ifdef RT_BIG_ENDIAN
|
---|
941 | # define RTUINT512_INIT(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
|
---|
942 | { { a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0 } }
|
---|
943 | #else
|
---|
944 | # define RTUINT512_INIT(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
|
---|
945 | { { a_Qw0, a_Qw1, a_Qw2, a_Qw3, a_Qw4, a_Qw5, a_Qw6, a_Qw7 } }
|
---|
946 | #endif
|
---|
947 |
|
---|
948 | /** @def RTUINT512_INIT_C
|
---|
949 | * Portable RTUINT512U initializer for 64-bit constants. */
|
---|
950 | #define RTUINT512_INIT_C(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
|
---|
951 | RTUINT512_INIT(UINT64_C(a_Qw7), UINT64_C(a_Qw6), UINT64_C(a_Qw5), UINT64_C(a_Qw4), \
|
---|
952 | UINT64_C(a_Qw3), UINT64_C(a_Qw2), UINT64_C(a_Qw1), UINT64_C(a_Qw0))
|
---|
953 |
|
---|
954 |
|
---|
955 | /**
|
---|
956 | * Single precision floating point format (32-bit).
|
---|
957 | */
|
---|
958 | typedef union RTFLOAT32U
|
---|
959 | {
|
---|
960 | /** Format using regular bitfields. */
|
---|
961 | struct
|
---|
962 | {
|
---|
963 | # ifdef RT_BIG_ENDIAN
|
---|
964 | /** The sign indicator. */
|
---|
965 | uint32_t fSign : 1;
|
---|
966 | /** The exponent (offsetted by 127). */
|
---|
967 | uint32_t uExponent : 8;
|
---|
968 | /** The fraction. */
|
---|
969 | uint32_t uFraction : 23;
|
---|
970 | # else
|
---|
971 | /** The fraction. */
|
---|
972 | uint32_t uFraction : 23;
|
---|
973 | /** The exponent (offsetted by 127). */
|
---|
974 | uint32_t uExponent : 8;
|
---|
975 | /** The sign indicator. */
|
---|
976 | uint32_t fSign : 1;
|
---|
977 | # endif
|
---|
978 | } s;
|
---|
979 |
|
---|
980 | #if 1 /** @todo exclude targets which doesn't have a 64-bit double type. (currently none) */
|
---|
981 | /** Double view. */
|
---|
982 | float r;
|
---|
983 | #endif
|
---|
984 | /** Unsigned integer view. */
|
---|
985 | uint32_t u;
|
---|
986 | /** 32-bit view. */
|
---|
987 | uint32_t au32[1];
|
---|
988 | /** 16-bit view. */
|
---|
989 | uint16_t au16[2];
|
---|
990 | /** 8-bit view. */
|
---|
991 | uint8_t au8[4];
|
---|
992 | } RTFLOAT32U;
|
---|
993 | /** Pointer to a single precision floating point format union. */
|
---|
994 | typedef RTFLOAT32U RT_FAR *PRTFLOAT32U;
|
---|
995 | /** Pointer to a const single precision floating point format union. */
|
---|
996 | typedef const RTFLOAT32U RT_FAR *PCRTFLOAT32U;
|
---|
997 | /** RTFLOAT32U initializer. */
|
---|
998 | #ifdef RT_BIG_ENDIAN
|
---|
999 | # define RTFLOAT32U_INIT(a_fSign, a_uFraction, a_uExponent) { { (a_fSign), (a_uExponent), (a_uFraction) } }
|
---|
1000 | #else
|
---|
1001 | # define RTFLOAT32U_INIT(a_fSign, a_uFraction, a_uExponent) { { (a_uFraction), (a_uExponent), (a_fSign) } }
|
---|
1002 | #endif
|
---|
1003 | #define RTFLOAT32U_INIT_C(a_fSign, a_uFraction, a_uExponent) RTFLOAT32U_INIT((a_fSign), UINT32_C(a_uFraction), (a_uExponent))
|
---|
1004 | #define RTFLOAT32U_INIT_ZERO(a_fSign) RTFLOAT32U_INIT((a_fSign), 0, 0)
|
---|
1005 | #define RTFLOAT32U_INIT_INF(a_fSign) RTFLOAT32U_INIT((a_fSign), 0, RTFLOAT32U_EXP_MAX)
|
---|
1006 | #define RTFLOAT32U_INIT_SNAN(a_fSign) RTFLOAT32U_INIT((a_fSign), 1, RTFLOAT32U_EXP_MAX)
|
---|
1007 | #define RTFLOAT32U_INIT_SNAN_EX(a_fSign, a_uVal) RTFLOAT32U_INIT((a_fSign), (a_uVal) ? (a_uVal) : 1, RTFLOAT32U_EXP_MAX)
|
---|
1008 | #define RTFLOAT32U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT32U_INIT_SNAN(a_fSign)
|
---|
1009 | #define RTFLOAT32U_INIT_QNAN(a_fSign) RTFLOAT32U_INIT((a_fSign), RT_BIT_32(RTFLOAT32U_FRACTION_BITS - 1), RTFLOAT32U_EXP_MAX)
|
---|
1010 | #define RTFLOAT32U_INIT_QNAN_EX(a_fSign, a_uVal) RTFLOAT32U_INIT((a_fSign), RT_BIT_32(RTFLOAT32U_FRACTION_BITS - 1) | (a_uVal), RTFLOAT32U_EXP_MAX)
|
---|
1011 | #define RTFLOAT32U_INIT_QUIET_NAN(a_fSign) RTFLOAT32U_INIT_QNAN(a_fSign)
|
---|
1012 | #define RTFLOAT32U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uVal) \
|
---|
1013 | RTFLOAT32U_INIT((a_fSign), \
|
---|
1014 | ((a_uVal) || (a_fQuiet) ? (a_uVal) : 1) | ((a_fQuiet) ? RT_BIT_32(RTFLOAT32U_FRACTION_BITS - 1) : 0), \
|
---|
1015 | RTFLOAT32U_EXP_MAX)
|
---|
1016 |
|
---|
1017 | /** The exponent bias for the RTFLOAT32U format. */
|
---|
1018 | #define RTFLOAT32U_EXP_BIAS (127)
|
---|
1019 | /** The max exponent value for the RTFLOAT32U format. */
|
---|
1020 | #define RTFLOAT32U_EXP_MAX (255)
|
---|
1021 | /** The exponent bias overflow/underflow adjust for the RTFLOAT32U format.
|
---|
1022 | * @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
|
---|
1023 | #define RTFLOAT32U_EXP_BIAS_ADJUST (192)
|
---|
1024 | /** Fraction width (in bits) for the RTFLOAT32U format. */
|
---|
1025 | #define RTFLOAT32U_FRACTION_BITS (23)
|
---|
1026 | /** Check if two 32-bit floating values are identical (memcmp, not
|
---|
1027 | * numerically). */
|
---|
1028 | #define RTFLOAT32U_ARE_IDENTICAL(a_pLeft, a_pRight) ((a_pLeft)->u == (a_pRight)->u)
|
---|
1029 | /** @name RTFLOAT32U classification macros
|
---|
1030 | * @{ */
|
---|
1031 | #define RTFLOAT32U_IS_ZERO(a_pr32) (((a_pr32)->u & (RT_BIT_32(31) - 1)) == 0)
|
---|
1032 | #define RTFLOAT32U_IS_SUBNORMAL(a_pr32) ((a_pr32)->s.uExponent == 0 && (a_pr32)->s.uFraction != 0)
|
---|
1033 | #define RTFLOAT32U_IS_INF(a_pr32) ((a_pr32)->s.uExponent == 0xff && (a_pr32)->s.uFraction == 0)
|
---|
1034 | #define RTFLOAT32U_IS_SIGNALLING_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && !((a_pr32)->s.uFraction & RT_BIT_32(22)) \
|
---|
1035 | && (a_pr32)->s.uFraction != 0)
|
---|
1036 | #define RTFLOAT32U_IS_QUIET_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && ((a_pr32)->s.uFraction & RT_BIT_32(22)))
|
---|
1037 | #define RTFLOAT32U_IS_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && (a_pr32)->s.uFraction != 0)
|
---|
1038 | #define RTFLOAT32U_IS_NORMAL(a_pr32) ((a_pr32)->s.uExponent > 0 && (a_pr32)->s.uExponent < 0xff)
|
---|
1039 | /** @} */
|
---|
1040 |
|
---|
1041 |
|
---|
1042 | /**
|
---|
1043 | * Double precision floating point format (64-bit).
|
---|
1044 | */
|
---|
1045 | typedef union RTFLOAT64U
|
---|
1046 | {
|
---|
1047 | /** Format using regular bitfields. */
|
---|
1048 | struct
|
---|
1049 | {
|
---|
1050 | # ifdef RT_BIG_ENDIAN
|
---|
1051 | /** The sign indicator. */
|
---|
1052 | uint32_t fSign : 1;
|
---|
1053 | /** The exponent (offsetted by 1023). */
|
---|
1054 | uint32_t uExponent : 11;
|
---|
1055 | /** The fraction, bits 32 thru 51. */
|
---|
1056 | uint32_t uFractionHigh : 20;
|
---|
1057 | /** The fraction, bits 0 thru 31. */
|
---|
1058 | uint32_t uFractionLow;
|
---|
1059 | # else
|
---|
1060 | /** The fraction, bits 0 thru 31. */
|
---|
1061 | uint32_t uFractionLow;
|
---|
1062 | /** The fraction, bits 32 thru 51. */
|
---|
1063 | uint32_t uFractionHigh : 20;
|
---|
1064 | /** The exponent (offsetted by 1023). */
|
---|
1065 | uint32_t uExponent : 11;
|
---|
1066 | /** The sign indicator. */
|
---|
1067 | uint32_t fSign : 1;
|
---|
1068 | # endif
|
---|
1069 | } s;
|
---|
1070 |
|
---|
1071 | #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
1072 | /** Format using 64-bit bitfields. */
|
---|
1073 | RT_GCC_EXTENSION struct
|
---|
1074 | {
|
---|
1075 | # ifdef RT_BIG_ENDIAN
|
---|
1076 | /** The sign indicator. */
|
---|
1077 | RT_GCC_EXTENSION uint64_t fSign : 1;
|
---|
1078 | /** The exponent (offsetted by 1023). */
|
---|
1079 | RT_GCC_EXTENSION uint64_t uExponent : 11;
|
---|
1080 | /** The fraction. */
|
---|
1081 | RT_GCC_EXTENSION uint64_t uFraction : 52;
|
---|
1082 | # else
|
---|
1083 | /** The fraction. */
|
---|
1084 | RT_GCC_EXTENSION uint64_t uFraction : 52;
|
---|
1085 | /** The exponent (offsetted by 1023). */
|
---|
1086 | RT_GCC_EXTENSION uint64_t uExponent : 11;
|
---|
1087 | /** The sign indicator. */
|
---|
1088 | RT_GCC_EXTENSION uint64_t fSign : 1;
|
---|
1089 | # endif
|
---|
1090 | } s64;
|
---|
1091 | #endif
|
---|
1092 |
|
---|
1093 | #if 1 /** @todo exclude targets which doesn't have a 64-bit double type. (currently none) */
|
---|
1094 | /** Double view. */
|
---|
1095 | double rd, r;
|
---|
1096 | #endif
|
---|
1097 | #ifdef RT_COMPILER_WITH_64BIT_LONG_DOUBLE
|
---|
1098 | /** Long double view. */
|
---|
1099 | long double lrd;
|
---|
1100 | #endif
|
---|
1101 | /** Unsigned integer view. */
|
---|
1102 | uint64_t u;
|
---|
1103 | /** 64-bit view. */
|
---|
1104 | uint64_t au64[1];
|
---|
1105 | /** 32-bit view. */
|
---|
1106 | uint32_t au32[2];
|
---|
1107 | /** 16-bit view. */
|
---|
1108 | uint16_t au16[4];
|
---|
1109 | /** 8-bit view. */
|
---|
1110 | uint8_t au8[8];
|
---|
1111 | } RTFLOAT64U;
|
---|
1112 | /** Pointer to a double precision floating point format union. */
|
---|
1113 | typedef RTFLOAT64U RT_FAR *PRTFLOAT64U;
|
---|
1114 | /** Pointer to a const double precision floating point format union. */
|
---|
1115 | typedef const RTFLOAT64U RT_FAR *PCRTFLOAT64U;
|
---|
1116 | /** RTFLOAT64U initializer. */
|
---|
1117 | #ifdef RT_BIG_ENDIAN
|
---|
1118 | # define RTFLOAT64U_INIT(a_fSign, a_uFraction, a_uExponent) \
|
---|
1119 | { { (a_fSign), (a_uExponent), (uint32_t)((a_uFraction) >> 32), (uint32_t)((a_uFraction) & UINT32_MAX) } }
|
---|
1120 | #else
|
---|
1121 | # define RTFLOAT64U_INIT(a_fSign, a_uFraction, a_uExponent) \
|
---|
1122 | { { (uint32_t)((a_uFraction) & UINT32_MAX), (uint32_t)((a_uFraction) >> 32), (a_uExponent), (a_fSign) } }
|
---|
1123 | #endif
|
---|
1124 | #define RTFLOAT64U_INIT_C(a_fSign, a_uFraction, a_uExponent) RTFLOAT64U_INIT((a_fSign), UINT64_C(a_uFraction), (a_uExponent))
|
---|
1125 | #define RTFLOAT64U_INIT_ZERO(a_fSign) RTFLOAT64U_INIT((a_fSign), UINT64_C(0), 0)
|
---|
1126 | #define RTFLOAT64U_INIT_INF(a_fSign) RTFLOAT64U_INIT((a_fSign), UINT64_C(0), RTFLOAT64U_EXP_MAX)
|
---|
1127 | #define RTFLOAT64U_INIT_SNAN(a_fSign) RTFLOAT64U_INIT((a_fSign), UINT64_C(1), RTFLOAT64U_EXP_MAX)
|
---|
1128 | #define RTFLOAT64U_INIT_SNAN_EX(a_fSign, a_uVal) RTFLOAT64U_INIT((a_fSign), (a_uVal) ? (a_uVal) : UINT64_C(1), RTFLOAT64U_EXP_MAX)
|
---|
1129 | #define RTFLOAT64U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT64U_INIT_SNAN(a_fSign)
|
---|
1130 | #define RTFLOAT64U_INIT_QNAN(a_fSign) RTFLOAT64U_INIT((a_fSign), RT_BIT_64(RTFLOAT64U_FRACTION_BITS - 1), RTFLOAT64U_EXP_MAX)
|
---|
1131 | #define RTFLOAT64U_INIT_QNAN_EX(a_fSign, a_uVal) RTFLOAT64U_INIT((a_fSign), RT_BIT_64(RTFLOAT64U_FRACTION_BITS - 1) | (a_uVal), RTFLOAT64U_EXP_MAX)
|
---|
1132 | #define RTFLOAT64U_INIT_QUIET_NAN(a_fSign) RTFLOAT64U_INIT_QNAN(a_fSign)
|
---|
1133 | #define RTFLOAT64U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uVal) \
|
---|
1134 | RTFLOAT64U_INIT((a_fSign), \
|
---|
1135 | ((a_uVal) || (a_fQuiet) ? (a_uVal) : UINT64_C(1)) | ((a_fQuiet) ? RT_BIT_64(RTFLOAT64U_FRACTION_BITS - 1) : UINT64_C(0)), \
|
---|
1136 | RTFLOAT64U_EXP_MAX)
|
---|
1137 |
|
---|
1138 | /** The exponent bias for the RTFLOAT64U format. */
|
---|
1139 | #define RTFLOAT64U_EXP_BIAS (1023)
|
---|
1140 | /** The max exponent value for the RTFLOAT64U format. */
|
---|
1141 | #define RTFLOAT64U_EXP_MAX (2047)
|
---|
1142 | /** The exponent bias overflow/underflow adjust for the RTFLOAT64U format.
|
---|
1143 | * @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
|
---|
1144 | #define RTFLOAT64U_EXP_BIAS_ADJUST (1536)
|
---|
1145 | /** Fraction width (in bits) for the RTFLOAT64U format. */
|
---|
1146 | #define RTFLOAT64U_FRACTION_BITS (52)
|
---|
1147 | /** Check if two 64-bit floating values are identical (memcmp, not
|
---|
1148 | * numerically). */
|
---|
1149 | #define RTFLOAT64U_ARE_IDENTICAL(a_pLeft, a_pRight) ((a_pLeft)->u == (a_pRight)->u)
|
---|
1150 | /** @name RTFLOAT64U classification macros
|
---|
1151 | * @{ */
|
---|
1152 | #define RTFLOAT64U_IS_ZERO(a_pr64) (((a_pr64)->u & (RT_BIT_64(63) - 1)) == 0)
|
---|
1153 | #define RTFLOAT64U_IS_SUBNORMAL(a_pr64) ( (a_pr64)->s.uExponent == 0 \
|
---|
1154 | && ((a_pr64)->s.uFractionLow != 0 || (a_pr64)->s.uFractionHigh != 0) )
|
---|
1155 | #define RTFLOAT64U_IS_INF(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
|
---|
1156 | && (a_pr64)->s.uFractionLow == 0 && (a_pr64)->s.uFractionHigh == 0)
|
---|
1157 | #define RTFLOAT64U_IS_SIGNALLING_NAN(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
|
---|
1158 | && !((a_pr64)->s.uFractionHigh & RT_BIT_32(19)) \
|
---|
1159 | && ((a_pr64)->s.uFractionHigh != 0 || (a_pr64)->s.uFractionLow != 0) )
|
---|
1160 | #define RTFLOAT64U_IS_QUIET_NAN(a_pr64) ((a_pr64)->s.uExponent == 0x7ff && ((a_pr64)->s.uFractionHigh & RT_BIT_32(19)))
|
---|
1161 | #define RTFLOAT64U_IS_NAN(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
|
---|
1162 | && ((a_pr64)->s.uFractionHigh != 0 || (a_pr64)->s.uFractionLow != 0) )
|
---|
1163 | #define RTFLOAT64U_IS_NORMAL(a_pr64) ((a_pr64)->s.uExponent > 0 && (a_pr64)->s.uExponent < 0x7ff)
|
---|
1164 | /** @} */
|
---|
1165 |
|
---|
1166 |
|
---|
1167 |
|
---|
1168 | #if !defined(__IBMCPP__) && !defined(__IBMC__)
|
---|
1169 |
|
---|
1170 | /**
|
---|
1171 | * Extended Double precision floating point format (80-bit).
|
---|
1172 | */
|
---|
1173 | # pragma pack(1)
|
---|
1174 | typedef union RTFLOAT80U
|
---|
1175 | {
|
---|
1176 | /** Format using bitfields. */
|
---|
1177 | RT_GCC_EXTENSION struct
|
---|
1178 | {
|
---|
1179 | # ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
|
---|
1180 | /** The sign indicator. */
|
---|
1181 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1182 | /** The exponent (offsetted by 16383). */
|
---|
1183 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1184 | /** The mantissa. */
|
---|
1185 | uint64_t uMantissa;
|
---|
1186 | # else
|
---|
1187 | /** The mantissa. */
|
---|
1188 | uint64_t uMantissa;
|
---|
1189 | /** The exponent (offsetted by 16383). */
|
---|
1190 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1191 | /** The sign indicator. */
|
---|
1192 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1193 | # endif
|
---|
1194 | } s;
|
---|
1195 |
|
---|
1196 | /** Format for accessing it as two separate components. */
|
---|
1197 | RT_GCC_EXTENSION struct
|
---|
1198 | {
|
---|
1199 | # ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
|
---|
1200 | /** The sign bit and exponent. */
|
---|
1201 | uint16_t uSignAndExponent;
|
---|
1202 | /** The mantissa. */
|
---|
1203 | uint64_t uMantissa;
|
---|
1204 | # else
|
---|
1205 | /** The mantissa. */
|
---|
1206 | uint64_t uMantissa;
|
---|
1207 | /** The sign bit and exponent. */
|
---|
1208 | uint16_t uSignAndExponent;
|
---|
1209 | # endif
|
---|
1210 | } s2;
|
---|
1211 |
|
---|
1212 | # ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
1213 | /** 64-bit bitfields exposing the J bit and the fraction. */
|
---|
1214 | RT_GCC_EXTENSION struct
|
---|
1215 | {
|
---|
1216 | # ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
|
---|
1217 | /** The sign indicator. */
|
---|
1218 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1219 | /** The exponent (offsetted by 16383). */
|
---|
1220 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1221 | /** The J bit, aka the integer bit. */
|
---|
1222 | RT_GCC_EXTENSION uint64_t fInteger : 1;
|
---|
1223 | /** The fraction. */
|
---|
1224 | RT_GCC_EXTENSION uint64_t uFraction : 63;
|
---|
1225 | # else
|
---|
1226 | /** The fraction. */
|
---|
1227 | RT_GCC_EXTENSION uint64_t uFraction : 63;
|
---|
1228 | /** The J bit, aka the integer bit. */
|
---|
1229 | RT_GCC_EXTENSION uint64_t fInteger : 1;
|
---|
1230 | /** The exponent (offsetted by 16383). */
|
---|
1231 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1232 | /** The sign indicator. */
|
---|
1233 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1234 | # endif
|
---|
1235 | } sj64;
|
---|
1236 | # endif
|
---|
1237 |
|
---|
1238 | /** 64-bit view. */
|
---|
1239 | uint64_t au64[1];
|
---|
1240 | /** 32-bit view. */
|
---|
1241 | uint32_t au32[2];
|
---|
1242 | /** 16-bit view. */
|
---|
1243 | uint16_t au16[5];
|
---|
1244 | /** 8-bit view. */
|
---|
1245 | uint8_t au8[10];
|
---|
1246 | } RTFLOAT80U;
|
---|
1247 | # pragma pack()
|
---|
1248 | /** Pointer to a extended precision floating point format union. */
|
---|
1249 | typedef RTFLOAT80U RT_FAR *PRTFLOAT80U;
|
---|
1250 | /** Pointer to a const extended precision floating point format union. */
|
---|
1251 | typedef const RTFLOAT80U RT_FAR *PCRTFLOAT80U;
|
---|
1252 | /** RTFLOAT80U initializer. */
|
---|
1253 | # ifdef RT_BIG_ENDIAN
|
---|
1254 | # define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_fSign), (a_uExponent), (a_uMantissa) } }
|
---|
1255 | # else
|
---|
1256 | # define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_uMantissa), (a_uExponent), (a_fSign) } }
|
---|
1257 | # endif
|
---|
1258 | # define RTFLOAT80U_INIT_C(a_fSign, a_uMantissa, a_uExponent) RTFLOAT80U_INIT((a_fSign), UINT64_C(a_uMantissa), (a_uExponent))
|
---|
1259 | # define RTFLOAT80U_INIT_ZERO(a_fSign) RTFLOAT80U_INIT((a_fSign), 0, 0)
|
---|
1260 | # define RTFLOAT80U_INIT_INF(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63), RTFLOAT80U_EXP_MAX)
|
---|
1261 | # define RTFLOAT80U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT80U_INIT_SNAN((a_fSign))
|
---|
1262 | # define RTFLOAT80U_INIT_SNAN(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | 1, RTFLOAT80U_EXP_MAX)
|
---|
1263 | # define RTFLOAT80U_INIT_SNAN_EX(a_fSign, a_uVal) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | (a_uVal), RTFLOAT80U_EXP_MAX)
|
---|
1264 | # define RTFLOAT80U_INIT_QUIET_NAN(a_fSign) RTFLOAT80U_INIT_QNAN((a_fSign))
|
---|
1265 | # define RTFLOAT80U_INIT_QNAN(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62), RTFLOAT80U_EXP_MAX)
|
---|
1266 | # define RTFLOAT80U_INIT_QNAN_EX(a_fSign, a_uVal) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62) | (a_uVal), RTFLOAT80U_EXP_MAX)
|
---|
1267 | #define RTFLOAT80U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uVal) \
|
---|
1268 | RTFLOAT80U_INIT((a_fSign), \
|
---|
1269 | ((a_uVal) || (a_fQuiet) ? (a_uVal) : UINT64_C(1)) | ((a_fQuiet) ? RT_BIT_64(63) | RT_BIT_64(62) : RT_BIT_64(63)), \
|
---|
1270 | RTFLOAT80U_EXP_MAX)
|
---|
1271 | # define RTFLOAT80U_INIT_INDEFINITE(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62), RTFLOAT80U_EXP_MAX)
|
---|
1272 | # define RTFLOAT80U_INIT_IND(a_fSign) RTFLOAT80U_INIT_INDEFINITE(a_fSign)
|
---|
1273 | /** The exponent bias for the RTFLOAT80U format. */
|
---|
1274 | # define RTFLOAT80U_EXP_BIAS (16383)
|
---|
1275 | /** The max exponent value for the RTFLOAT80U format. */
|
---|
1276 | # define RTFLOAT80U_EXP_MAX (32767)
|
---|
1277 | /** The exponent bias overflow/underflow adjust for the RTFLOAT80U format.
|
---|
1278 | * @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
|
---|
1279 | # define RTFLOAT80U_EXP_BIAS_ADJUST (24576)
|
---|
1280 | /** Fraction width (in bits) for the RTFLOAT80U format. */
|
---|
1281 | # define RTFLOAT80U_FRACTION_BITS (63)
|
---|
1282 | /** Check if two 80-bit floating values are identical (memcmp, not
|
---|
1283 | * numberically). */
|
---|
1284 | # define RTFLOAT80U_ARE_IDENTICAL(a_pLeft, a_pRight) \
|
---|
1285 | ( (a_pLeft)->au64[0] == (a_pRight)->au64[0] \
|
---|
1286 | && (a_pLeft)->au16[4] == (a_pRight)->au16[4] )
|
---|
1287 | /** @name RTFLOAT80U classification macros
|
---|
1288 | * @{ */
|
---|
1289 | /** Is @a a_pr80 +0 or -0. */
|
---|
1290 | # define RTFLOAT80U_IS_ZERO(a_pr80) RTFLOAT80U_IS_ZERO_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1291 | # define RTFLOAT80U_IS_ZERO_EX(a_uMantissa, a_uExponent) \
|
---|
1292 | ((a_uExponent) == 0 && (a_uMantissa) == 0)
|
---|
1293 | /** Is @a a_pr80 a denormal (does not match psuedo-denormal). */
|
---|
1294 | # define RTFLOAT80U_IS_DENORMAL(a_pr80) RTFLOAT80U_IS_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1295 | # define RTFLOAT80U_IS_DENORMAL_EX(a_uMantissa, a_uExponent) \
|
---|
1296 | ((a_uExponent) == 0 && (a_uMantissa) < RT_BIT_64(63) && (a_uMantissa) != 0)
|
---|
1297 | /** Is @a a_pr80 a pseudo-denormal. */
|
---|
1298 | # define RTFLOAT80U_IS_PSEUDO_DENORMAL(a_pr80) RTFLOAT80U_IS_PSEUDO_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1299 | # define RTFLOAT80U_IS_PSEUDO_DENORMAL_EX(a_uMantissa, a_uExponent) \
|
---|
1300 | ((a_uExponent) == 0 && (a_uMantissa) >= RT_BIT_64(63))
|
---|
1301 | /** Is @a a_pr80 denormal or pseudo-denormal. */
|
---|
1302 | # define RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL(a_pr80) \
|
---|
1303 | RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1304 | # define RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0 && (a_uMantissa) != 0)
|
---|
1305 | /** Is @a a_pr80 +/-pseudo-infinity. */
|
---|
1306 | # define RTFLOAT80U_IS_PSEUDO_INF(a_pr80) RTFLOAT80U_IS_PSEUDO_INF_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1307 | # define RTFLOAT80U_IS_PSEUDO_INF_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && (a_uMantissa) == 0)
|
---|
1308 | /** Is @a a_pr80 pseudo-not-a-number. */
|
---|
1309 | # define RTFLOAT80U_IS_PSEUDO_NAN(a_pr80) RTFLOAT80U_IS_PSEUDO_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1310 | # define RTFLOAT80U_IS_PSEUDO_NAN_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && !((a_uMantissa) & RT_BIT_64(63)))
|
---|
1311 | /** Is @a a_pr80 infinity (does not match pseudo-infinity). */
|
---|
1312 | # define RTFLOAT80U_IS_INF(a_pr80) RTFLOAT80U_IS_INF_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1313 | # define RTFLOAT80U_IS_INF_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && (a_uMantissa) == RT_BIT_64(63))
|
---|
1314 | /** Is @a a_pr80 a signalling not-a-number value. */
|
---|
1315 | # define RTFLOAT80U_IS_SIGNALLING_NAN(a_pr80) RTFLOAT80U_IS_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1316 | # define RTFLOAT80U_IS_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
|
---|
1317 | ( (a_uExponent) == 0x7fff \
|
---|
1318 | && ((a_uMantissa) & (RT_BIT_64(63) | RT_BIT_64(62))) == RT_BIT_64(63) \
|
---|
1319 | && ((a_uMantissa) & (RT_BIT_64(62) - 1)) != 0)
|
---|
1320 | /** Is @a a_pr80 a quiet not-a-number value. */
|
---|
1321 | # define RTFLOAT80U_IS_QUIET_NAN(a_pr80) RTFLOAT80U_IS_QUIET_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1322 | # define RTFLOAT80U_IS_QUIET_NAN_EX(a_uMantissa, a_uExponent) \
|
---|
1323 | ( (a_uExponent) == 0x7fff \
|
---|
1324 | && ((a_uMantissa) & (RT_BIT_64(63) | RT_BIT_64(62))) == (RT_BIT_64(63) | RT_BIT_64(62)) \
|
---|
1325 | && ((a_uMantissa) & (RT_BIT_64(62) - 1)) != 0)
|
---|
1326 | /** Is @a a_pr80 Signalling-, Quiet- or Pseudo-NaN. */
|
---|
1327 | # define RTFLOAT80U_IS_NAN(a_pr80) RTFLOAT80U_IS_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1328 | # define RTFLOAT80U_IS_NAN_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && ((a_uMantissa) & (RT_BIT_64(63) - 1)) != 0)
|
---|
1329 | /** Is @a a_pr80 Signalling- or Quiet-Nan, but not Pseudo-NaN. */
|
---|
1330 | # define RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN(a_pr80) \
|
---|
1331 | RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1332 | # define RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
|
---|
1333 | ((a_uExponent) == 0x7fff && ((a_uMantissa) > RT_BIT_64(63)))
|
---|
1334 | /** Is @a a_pr80 indefinite (ignoring sign). */
|
---|
1335 | # define RTFLOAT80U_IS_INDEFINITE(a_pr80) RTFLOAT80U_IS_INDEFINITE_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1336 | # define RTFLOAT80U_IS_INDEFINITE_EX(a_uMantissa, a_uExponent) \
|
---|
1337 | ((a_uExponent) == 0x7fff && (a_uMantissa) == (RT_BIT_64(63) | RT_BIT_64(62)))
|
---|
1338 | /** Is @a a_pr80 Indefinite, Signalling- or Quiet-Nan, but not Pseudo-NaN (nor Infinity). */
|
---|
1339 | # define RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN(a_pr80) \
|
---|
1340 | RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1341 | # define RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
|
---|
1342 | ((a_uExponent) == 0x7fff && (a_uMantissa) > RT_BIT_64(63))
|
---|
1343 | /** Is @a a_pr80 an unnormal value (invalid operand on 387+). */
|
---|
1344 | # define RTFLOAT80U_IS_UNNORMAL(a_pr80) RTFLOAT80U_IS_UNNORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1345 | # define RTFLOAT80U_IS_UNNORMAL_EX(a_uMantissa, a_uExponent) \
|
---|
1346 | (!((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0 && (a_uExponent) < 0x7fff) /* a_uExponent can be signed and up to 64-bit wide */
|
---|
1347 | /** Is @a a_pr80 a normal value (excludes zero). */
|
---|
1348 | # define RTFLOAT80U_IS_NORMAL(a_pr80) RTFLOAT80U_IS_NORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1349 | # define RTFLOAT80U_IS_NORMAL_EX(a_uMantissa, a_uExponent) \
|
---|
1350 | (((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0 && (a_uExponent) < 0x7fff) /* a_uExponent can be signed and up to 64-bit wide */
|
---|
1351 | /** Invalid 387 (and later) operands: Pseudo-Infinity, Psuedo-NaN, Unnormals. */
|
---|
1352 | #define RTFLOAT80U_IS_387_INVALID(a_pr80) RTFLOAT80U_IS_387_INVALID_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
|
---|
1353 | #define RTFLOAT80U_IS_387_INVALID_EX(a_uMantissa, a_uExponent) \
|
---|
1354 | (!((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0)
|
---|
1355 | /** @} */
|
---|
1356 |
|
---|
1357 |
|
---|
1358 | /**
|
---|
1359 | * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
|
---|
1360 | * compiler implements long double.
|
---|
1361 | *
|
---|
1362 | * @note On AMD64 systems implementing the System V ABI, this will be 16 bytes!
|
---|
1363 | * The last 6 bytes are unused padding taken up by the long double view.
|
---|
1364 | */
|
---|
1365 | # pragma pack(1)
|
---|
1366 | typedef union RTFLOAT80U2
|
---|
1367 | {
|
---|
1368 | /** Format using bitfields. */
|
---|
1369 | RT_GCC_EXTENSION struct
|
---|
1370 | {
|
---|
1371 | # ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
|
---|
1372 | /** The sign indicator. */
|
---|
1373 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1374 | /** The exponent (offsetted by 16383). */
|
---|
1375 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1376 | /** The mantissa. */
|
---|
1377 | uint64_t uMantissa;
|
---|
1378 | # else
|
---|
1379 | /** The mantissa. */
|
---|
1380 | uint64_t uMantissa;
|
---|
1381 | /** The exponent (offsetted by 16383). */
|
---|
1382 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1383 | /** The sign indicator. */
|
---|
1384 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1385 | # endif
|
---|
1386 | } s;
|
---|
1387 |
|
---|
1388 | /** Format for accessing it as two separate components. */
|
---|
1389 | RT_GCC_EXTENSION struct
|
---|
1390 | {
|
---|
1391 | # ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
|
---|
1392 | /** The sign bit and exponent. */
|
---|
1393 | uint16_t uSignAndExponent;
|
---|
1394 | /** The mantissa. */
|
---|
1395 | uint64_t uMantissa;
|
---|
1396 | # else
|
---|
1397 | /** The mantissa. */
|
---|
1398 | uint64_t uMantissa;
|
---|
1399 | /** The sign bit and exponent. */
|
---|
1400 | uint16_t uSignAndExponent;
|
---|
1401 | # endif
|
---|
1402 | } s2;
|
---|
1403 |
|
---|
1404 | /** Bitfield exposing the J bit and the fraction. */
|
---|
1405 | RT_GCC_EXTENSION struct
|
---|
1406 | {
|
---|
1407 | # ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
|
---|
1408 | /** The sign indicator. */
|
---|
1409 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1410 | /** The exponent (offsetted by 16383). */
|
---|
1411 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1412 | /** The J bit, aka the integer bit. */
|
---|
1413 | uint32_t fInteger : 1;
|
---|
1414 | /** The fraction, bits 32 thru 62. */
|
---|
1415 | uint32_t uFractionHigh : 31;
|
---|
1416 | /** The fraction, bits 0 thru 31. */
|
---|
1417 | uint32_t uFractionLow : 32;
|
---|
1418 | # else
|
---|
1419 | /** The fraction, bits 0 thru 31. */
|
---|
1420 | uint32_t uFractionLow : 32;
|
---|
1421 | /** The fraction, bits 32 thru 62. */
|
---|
1422 | uint32_t uFractionHigh : 31;
|
---|
1423 | /** The J bit, aka the integer bit. */
|
---|
1424 | uint32_t fInteger : 1;
|
---|
1425 | /** The exponent (offsetted by 16383). */
|
---|
1426 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1427 | /** The sign indicator. */
|
---|
1428 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1429 | # endif
|
---|
1430 | } sj;
|
---|
1431 |
|
---|
1432 | # ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
1433 | /** 64-bit bitfields exposing the J bit and the fraction. */
|
---|
1434 | RT_GCC_EXTENSION struct
|
---|
1435 | {
|
---|
1436 | # ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
|
---|
1437 | /** The sign indicator. */
|
---|
1438 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1439 | /** The exponent (offsetted by 16383). */
|
---|
1440 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1441 | /** The J bit, aka the integer bit. */
|
---|
1442 | RT_GCC_EXTENSION uint64_t fInteger : 1;
|
---|
1443 | /** The fraction. */
|
---|
1444 | RT_GCC_EXTENSION uint64_t uFraction : 63;
|
---|
1445 | # else
|
---|
1446 | /** The fraction. */
|
---|
1447 | RT_GCC_EXTENSION uint64_t uFraction : 63;
|
---|
1448 | /** The J bit, aka the integer bit. */
|
---|
1449 | RT_GCC_EXTENSION uint64_t fInteger : 1;
|
---|
1450 | /** The exponent (offsetted by 16383). */
|
---|
1451 | RT_GCC_EXTENSION uint16_t uExponent : 15;
|
---|
1452 | /** The sign indicator. */
|
---|
1453 | RT_GCC_EXTENSION uint16_t fSign : 1;
|
---|
1454 | # endif
|
---|
1455 | } sj64;
|
---|
1456 | # endif
|
---|
1457 |
|
---|
1458 | # ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
|
---|
1459 | /** Long double view. */
|
---|
1460 | long double lrd, r;
|
---|
1461 | # endif
|
---|
1462 | /** 64-bit view. */
|
---|
1463 | uint64_t au64[1];
|
---|
1464 | /** 32-bit view. */
|
---|
1465 | uint32_t au32[2];
|
---|
1466 | /** 16-bit view. */
|
---|
1467 | uint16_t au16[5];
|
---|
1468 | /** 8-bit view. */
|
---|
1469 | uint8_t au8[10];
|
---|
1470 | } RTFLOAT80U2;
|
---|
1471 | # pragma pack()
|
---|
1472 | /** Pointer to a extended precision floating point format union, 2nd
|
---|
1473 | * variant. */
|
---|
1474 | typedef RTFLOAT80U2 RT_FAR *PRTFLOAT80U2;
|
---|
1475 | /** Pointer to a const extended precision floating point format union, 2nd
|
---|
1476 | * variant. */
|
---|
1477 | typedef const RTFLOAT80U2 RT_FAR *PCRTFLOAT80U2;
|
---|
1478 |
|
---|
1479 | #endif /* uint16_t bitfields doesn't work */
|
---|
1480 |
|
---|
1481 |
|
---|
1482 | /**
|
---|
1483 | * Quadruple precision floating point format (128-bit).
|
---|
1484 | */
|
---|
1485 | typedef union RTFLOAT128U
|
---|
1486 | {
|
---|
1487 | /** Format using regular bitfields. */
|
---|
1488 | struct
|
---|
1489 | {
|
---|
1490 | # ifdef RT_BIG_ENDIAN
|
---|
1491 | /** The sign indicator. */
|
---|
1492 | uint32_t fSign : 1;
|
---|
1493 | /** The exponent (offsetted by 16383). */
|
---|
1494 | uint32_t uExponent : 15;
|
---|
1495 | /** The fraction, bits 96 thru 111. */
|
---|
1496 | uint32_t uFractionHigh : 16;
|
---|
1497 | /** The fraction, bits 64 thru 95. */
|
---|
1498 | uint32_t uFractionMid;
|
---|
1499 | /** The fraction, bits 0 thru 63. */
|
---|
1500 | uint64_t uFractionLow;
|
---|
1501 | # else
|
---|
1502 | /** The fraction, bits 0 thru 63. */
|
---|
1503 | uint64_t uFractionLow;
|
---|
1504 | /** The fraction, bits 64 thru 95. */
|
---|
1505 | uint32_t uFractionMid;
|
---|
1506 | /** The fraction, bits 96 thru 111. */
|
---|
1507 | uint32_t uFractionHigh : 16;
|
---|
1508 | /** The exponent (offsetted by 16383). */
|
---|
1509 | uint32_t uExponent : 15;
|
---|
1510 | /** The sign indicator. */
|
---|
1511 | uint32_t fSign : 1;
|
---|
1512 | # endif
|
---|
1513 | } s;
|
---|
1514 |
|
---|
1515 | /** Format for accessing it as two separate components. */
|
---|
1516 | struct
|
---|
1517 | {
|
---|
1518 | # ifdef RT_BIG_ENDIAN
|
---|
1519 | /** The sign bit and exponent. */
|
---|
1520 | uint16_t uSignAndExponent;
|
---|
1521 | /** The fraction, bits 96 thru 111. */
|
---|
1522 | uint16_t uFractionHigh;
|
---|
1523 | /** The fraction, bits 64 thru 95. */
|
---|
1524 | uint32_t uFractionMid;
|
---|
1525 | /** The fraction, bits 0 thru 63. */
|
---|
1526 | uint64_t uFractionLow;
|
---|
1527 | # else
|
---|
1528 | /** The fraction, bits 0 thru 63. */
|
---|
1529 | uint64_t uFractionLow;
|
---|
1530 | /** The fraction, bits 64 thru 95. */
|
---|
1531 | uint32_t uFractionMid;
|
---|
1532 | /** The fraction, bits 96 thru 111. */
|
---|
1533 | uint16_t uFractionHigh;
|
---|
1534 | /** The sign bit and exponent. */
|
---|
1535 | uint16_t uSignAndExponent;
|
---|
1536 | # endif
|
---|
1537 | } s2;
|
---|
1538 |
|
---|
1539 | #ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
|
---|
1540 | /** Format using 64-bit bitfields. */
|
---|
1541 | RT_GCC_EXTENSION struct
|
---|
1542 | {
|
---|
1543 | # ifdef RT_BIG_ENDIAN
|
---|
1544 | /** The sign indicator. */
|
---|
1545 | RT_GCC_EXTENSION uint64_t fSign : 1;
|
---|
1546 | /** The exponent (offsetted by 16383). */
|
---|
1547 | RT_GCC_EXTENSION uint64_t uExponent : 15;
|
---|
1548 | /** The fraction, bits 64 thru 111. */
|
---|
1549 | RT_GCC_EXTENSION uint64_t uFractionHi : 48;
|
---|
1550 | /** The fraction, bits 0 thru 63. */
|
---|
1551 | uint64_t uFractionLo;
|
---|
1552 | # else
|
---|
1553 | /** The fraction, bits 0 thru 63. */
|
---|
1554 | uint64_t uFractionLo;
|
---|
1555 | /** The fraction, bits 64 thru 111. */
|
---|
1556 | RT_GCC_EXTENSION uint64_t uFractionHi : 48;
|
---|
1557 | /** The exponent (offsetted by 16383). */
|
---|
1558 | RT_GCC_EXTENSION uint64_t uExponent : 15;
|
---|
1559 | /** The sign indicator. */
|
---|
1560 | RT_GCC_EXTENSION uint64_t fSign : 1;
|
---|
1561 | # endif
|
---|
1562 | } s64;
|
---|
1563 | #endif
|
---|
1564 |
|
---|
1565 | #ifdef RT_COMPILER_WITH_128BIT_LONG_DOUBLE
|
---|
1566 | /** Long double view. */
|
---|
1567 | long double lrd, r;
|
---|
1568 | #endif
|
---|
1569 | /** 128-bit view. */
|
---|
1570 | RTUINT128U u128;
|
---|
1571 | /** 64-bit view. */
|
---|
1572 | uint64_t au64[2];
|
---|
1573 | /** 32-bit view. */
|
---|
1574 | uint32_t au32[4];
|
---|
1575 | /** 16-bit view. */
|
---|
1576 | uint16_t au16[8];
|
---|
1577 | /** 8-bit view. */
|
---|
1578 | uint8_t au8[16];
|
---|
1579 | } RTFLOAT128U;
|
---|
1580 | /** Pointer to a quadruple precision floating point format union. */
|
---|
1581 | typedef RTFLOAT128U RT_FAR *PRTFLOAT128U;
|
---|
1582 | /** Pointer to a const quadruple precision floating point format union. */
|
---|
1583 | typedef const RTFLOAT128U RT_FAR *PCRTFLOAT128U;
|
---|
1584 | /** RTFLOAT128U initializer. */
|
---|
1585 | #ifdef RT_BIG_ENDIAN
|
---|
1586 | # define RTFLOAT128U_INIT(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
|
---|
1587 | { { (a_fSign), (a_uExponent), (uint32_t)((a_uFractionHi) >> 32), (uint32_t)((a_uFractionHi) & UINT32_MAX), (a_uFractionLo) } }
|
---|
1588 | #else
|
---|
1589 | # define RTFLOAT128U_INIT(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
|
---|
1590 | { { (a_uFractionLo), (uint32_t)((a_uFractionHi) & UINT32_MAX), (uint32_t)((a_uFractionHi) >> 32), (a_uExponent), (a_fSign) } }
|
---|
1591 | #endif
|
---|
1592 | #define RTFLOAT128U_INIT_C(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
|
---|
1593 | RTFLOAT128U_INIT((a_fSign), UINT64_C(a_uFractionHi), UINT64_C(a_uFractionLo), (a_uExponent))
|
---|
1594 |
|
---|
1595 | #define RTFLOAT128U_INIT_ZERO(a_fSign) RTFLOAT128U_INIT((a_fSign), UINT64_C(0), UINT64_C(0), 0)
|
---|
1596 | #define RTFLOAT128U_INIT_INF(a_fSign) RTFLOAT128U_INIT((a_fSign), UINT64_C(0), UINT64_C(0), RTFLOAT128U_EXP_MAX)
|
---|
1597 | #define RTFLOAT128U_INIT_SNAN(a_fSign) RTFLOAT128U_INIT((a_fSign), UINT64_C(0), UINT64_C(1), RTFLOAT128U_EXP_MAX)
|
---|
1598 | #define RTFLOAT128U_INIT_SNAN_EX(a_fSign, a_uValHi, a_uValLo) \
|
---|
1599 | RTFLOAT128U_INIT((a_fSign), (a_uValHi), (a_uValHi) || (a_uValLo) ? (a_uValLo) : UINT64_C(1), RTFLOAT128U_EXP_MAX)
|
---|
1600 | #define RTFLOAT128U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT128U_INIT_SNAN(a_fSign)
|
---|
1601 | #define RTFLOAT128U_INIT_QNAN(a_fSign) \
|
---|
1602 | RTFLOAT128U_INIT((a_fSign), RT_BIT_64(RTFLOAT128U_FRACTION_BITS - 1 - 64), UINT64_C(0), RTFLOAT128U_EXP_MAX)
|
---|
1603 | #define RTFLOAT128U_INIT_QNAN_EX(a_fSign, a_uValHi, a_uValLo) \
|
---|
1604 | RTFLOAT128U_INIT((a_fSign), RT_BIT_64(RTFLOAT128U_FRACTION_BITS - 1 - 64) | (a_uValHi), (a_uValLo), RTFLOAT128U_EXP_MAX)
|
---|
1605 | #define RTFLOAT128U_INIT_QUIET_NAN(a_fSign) RTFLOAT128U_INIT_QNAN(a_fSign)
|
---|
1606 | #define RTFLOAT128U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uValHi, a_uValLo) \
|
---|
1607 | RTFLOAT128U_INIT((a_fSign), \
|
---|
1608 | ((a_fQuiet) ? RT_BIT_64(RTFLOAT128U_FRACTION_BITS - 1 - 64) : 0) | (a_uValHi), \
|
---|
1609 | (a_uValLo) || (a_uValHi) || (a_fQuiet) ? (a_uValLo) : UINT64_C(1), \
|
---|
1610 | RTFLOAT128U_EXP_MAX)
|
---|
1611 |
|
---|
1612 | /** The exponent bias for the RTFLOAT128U format. */
|
---|
1613 | #define RTFLOAT128U_EXP_BIAS (16383)
|
---|
1614 | /** The max exponent value for the RTFLOAT128U format. */
|
---|
1615 | #define RTFLOAT128U_EXP_MAX (32767)
|
---|
1616 | /** The exponent bias overflow/underflow adjust for the RTFLOAT128U format.
|
---|
1617 | * @note This is stipulated based on RTFLOAT80U, it doesn't appear in any
|
---|
1618 | * standard text as far as we know. */
|
---|
1619 | #define RTFLOAT128U_EXP_BIAS_ADJUST (24576)
|
---|
1620 | /** Fraction width (in bits) for the RTFLOAT128U format. */
|
---|
1621 | #define RTFLOAT128U_FRACTION_BITS (112)
|
---|
1622 | /** Check if two 128-bit floating values are identical (memcmp, not
|
---|
1623 | * numerically). */
|
---|
1624 | #define RTFLOAT128U_ARE_IDENTICAL(a_pLeft, a_pRight) \
|
---|
1625 | ( (a_pLeft)->au64[0] == (a_pRight)->au64[0] && (a_pLeft)->au64[1] == (a_pRight)->au64[1] )
|
---|
1626 | /** @name RTFLOAT128U classification macros
|
---|
1627 | * @{ */
|
---|
1628 | #define RTFLOAT128U_IS_ZERO(a_pr128) ( (a_pr128)->u128.s.Lo == 0 \
|
---|
1629 | && ((a_pr128)->u128.s.Hi & (RT_BIT_64(63) - 1)) == 0)
|
---|
1630 | #define RTFLOAT128U_IS_SUBNORMAL(a_pr128) ( (a_pr128)->s.uExponent == 0 \
|
---|
1631 | && ( (a_pr128)->s.uFractionLow != 0 \
|
---|
1632 | || (a_pr128)->s.uFractionMid != 0 \
|
---|
1633 | || (a_pr128)->s.uFractionHigh != 0 ) )
|
---|
1634 | #define RTFLOAT128U_IS_INF(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
|
---|
1635 | && (a_pr128)->s.uFractionHigh == 0 \
|
---|
1636 | && (a_pr128)->s.uFractionMid == 0 \
|
---|
1637 | && (a_pr128)->s.uFractionLow == 0 )
|
---|
1638 | #define RTFLOAT128U_IS_SIGNALLING_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
|
---|
1639 | && !((a_pr128)->s.uFractionHigh & RT_BIT_32(15)) \
|
---|
1640 | && ( (a_pr128)->s.uFractionHigh != 0 \
|
---|
1641 | || (a_pr128)->s.uFractionMid != 0 \
|
---|
1642 | || (a_pr128)->s.uFractionLow != 0) )
|
---|
1643 | #define RTFLOAT128U_IS_QUIET_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
|
---|
1644 | && ((a_pr128)->s.uFractionHigh & RT_BIT_32(15)))
|
---|
1645 | #define RTFLOAT128U_IS_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
|
---|
1646 | && ( (a_pr128)->s.uFractionLow != 0 \
|
---|
1647 | || (a_pr128)->s.uFractionMid != 0 \
|
---|
1648 | || (a_pr128)->s.uFractionHigh != 0) )
|
---|
1649 | #define RTFLOAT128U_IS_NORMAL(a_pr128) ((a_pr128)->s.uExponent > 0 && (a_pr128)->s.uExponent < RTFLOAT128U_EXP_MAX)
|
---|
1650 | /** @} */
|
---|
1651 |
|
---|
1652 |
|
---|
1653 | /**
|
---|
1654 | * Packed BCD 18-digit signed integer format (80-bit).
|
---|
1655 | */
|
---|
1656 | #pragma pack(1)
|
---|
1657 | typedef union RTPBCD80U
|
---|
1658 | {
|
---|
1659 | /** Format using bitfields. */
|
---|
1660 | RT_GCC_EXTENSION struct
|
---|
1661 | {
|
---|
1662 | /** 18 packed BCD digits, two to a byte. */
|
---|
1663 | uint8_t abPairs[9];
|
---|
1664 | /** Padding, non-zero if indefinite. */
|
---|
1665 | RT_GCC_EXTENSION uint8_t uPad : 7;
|
---|
1666 | /** The sign indicator. */
|
---|
1667 | RT_GCC_EXTENSION uint8_t fSign : 1;
|
---|
1668 | } s;
|
---|
1669 |
|
---|
1670 | /** 64-bit view. */
|
---|
1671 | uint64_t au64[1];
|
---|
1672 | /** 32-bit view. */
|
---|
1673 | uint32_t au32[2];
|
---|
1674 | /** 16-bit view. */
|
---|
1675 | uint16_t au16[5];
|
---|
1676 | /** 8-bit view. */
|
---|
1677 | uint8_t au8[10];
|
---|
1678 | } RTPBCD80U;
|
---|
1679 | #pragma pack()
|
---|
1680 | /** Pointer to a packed BCD integer format union. */
|
---|
1681 | typedef RTPBCD80U RT_FAR *PRTPBCD80U;
|
---|
1682 | /** Pointer to a const packed BCD integer format union. */
|
---|
1683 | typedef const RTPBCD80U RT_FAR *PCRTPBCD80U;
|
---|
1684 | /** RTPBCD80U initializer. */
|
---|
1685 | #define RTPBCD80U_INIT_C(a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
|
---|
1686 | a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0) \
|
---|
1687 | RTPBCD80U_INIT_EX_C(0, a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
|
---|
1688 | a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0)
|
---|
1689 | /** Extended RTPBCD80U initializer. */
|
---|
1690 | #define RTPBCD80U_INIT_EX_C(a_uPad, a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
|
---|
1691 | a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0) \
|
---|
1692 | { { { RTPBCD80U_MAKE_PAIR(a_D1, a_D0), \
|
---|
1693 | RTPBCD80U_MAKE_PAIR(a_D3, a_D2), \
|
---|
1694 | RTPBCD80U_MAKE_PAIR(a_D5, a_D4), \
|
---|
1695 | RTPBCD80U_MAKE_PAIR(a_D7, a_D6), \
|
---|
1696 | RTPBCD80U_MAKE_PAIR(a_D9, a_D8), \
|
---|
1697 | RTPBCD80U_MAKE_PAIR(a_D11, a_D10), \
|
---|
1698 | RTPBCD80U_MAKE_PAIR(a_D13, a_D12), \
|
---|
1699 | RTPBCD80U_MAKE_PAIR(a_D15, a_D14), \
|
---|
1700 | RTPBCD80U_MAKE_PAIR(a_D17, a_D16), }, (a_uPad), (a_fSign) } }
|
---|
1701 | /** RTPBCD80U initializer for the zero value. */
|
---|
1702 | #define RTPBCD80U_INIT_ZERO(a_fSign) RTPBCD80U_INIT_C(a_fSign, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0)
|
---|
1703 | /** RTPBCD80U initializer for the indefinite value. */
|
---|
1704 | #define RTPBCD80U_INIT_INDEFINITE() RTPBCD80U_INIT_EX_C(0x7f,1, 0xf,0xf, 0xc,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0)
|
---|
1705 | /** RTPBCD80U initializer for the minimum value. */
|
---|
1706 | #define RTPBCD80U_INIT_MIN() RTPBCD80U_INIT_C(1, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9)
|
---|
1707 | /** RTPBCD80U initializer for the maximum value. */
|
---|
1708 | #define RTPBCD80U_INIT_MAX() RTPBCD80U_INIT_C(0, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9)
|
---|
1709 | /** RTPBCD80U minimum value. */
|
---|
1710 | #define RTPBCD80U_MIN INT64_C(-999999999999999999)
|
---|
1711 | /** RTPBCD80U maximum value. */
|
---|
1712 | #define RTPBCD80U_MAX INT64_C(999999999999999999)
|
---|
1713 | /** Makes a packs a pair of BCD digits. */
|
---|
1714 | #define RTPBCD80U_MAKE_PAIR(a_D1, a_D0) ((a_D0) | ((a_D1) << 4))
|
---|
1715 | /** Retrieves the lower digit of a BCD digit pair. */
|
---|
1716 | #define RTPBCD80U_LO_DIGIT(a_bPair) ((a_bPair) & 0xf)
|
---|
1717 | /** Retrieves the higher digit of a BCD digit pair. */
|
---|
1718 | #define RTPBCD80U_HI_DIGIT(a_bPair) ((a_bPair) >> 4)
|
---|
1719 | /** Checks if the packaged BCD number is representing indefinite. */
|
---|
1720 | #define RTPBCD80U_IS_INDEFINITE(a_pd80) \
|
---|
1721 | ( (a_pd80)->s.uPad == 0x7f \
|
---|
1722 | && (a_pd80)->s.fSign == 1 \
|
---|
1723 | && (a_pd80)->s.abPairs[8] == 0xff \
|
---|
1724 | && (a_pd80)->s.abPairs[7] == RTPBCD80U_MAKE_PAIR(0xc, 0) \
|
---|
1725 | && (a_pd80)->s.abPairs[6] == 0 \
|
---|
1726 | && (a_pd80)->s.abPairs[5] == 0 \
|
---|
1727 | && (a_pd80)->s.abPairs[4] == 0 \
|
---|
1728 | && (a_pd80)->s.abPairs[3] == 0 \
|
---|
1729 | && (a_pd80)->s.abPairs[2] == 0 \
|
---|
1730 | && (a_pd80)->s.abPairs[1] == 0 \
|
---|
1731 | && (a_pd80)->s.abPairs[0] == 0)
|
---|
1732 | /** Check if @a a_pd80Left and @a a_pd80Right are exactly the same. */
|
---|
1733 | #define RTPBCD80U_ARE_IDENTICAL(a_pd80Left, a_pd80Right) \
|
---|
1734 | ( (a_pd80Left)->au64[0] == (a_pd80Right)->au64[0] && (a_pd80Left)->au16[4] == (a_pd80Right)->au16[4] )
|
---|
1735 |
|
---|
1736 |
|
---|
1737 | /** Generic function type.
|
---|
1738 | * @see PFNRT
|
---|
1739 | */
|
---|
1740 | typedef DECLCALLBACKTYPE(void, FNRT,(void));
|
---|
1741 |
|
---|
1742 | /** Generic function pointer.
|
---|
1743 | * With -pedantic, gcc-4 complains when casting a function to a data object, for
|
---|
1744 | * example:
|
---|
1745 | *
|
---|
1746 | * @code
|
---|
1747 | * void foo(void)
|
---|
1748 | * {
|
---|
1749 | * }
|
---|
1750 | *
|
---|
1751 | * void *bar = (void *)foo;
|
---|
1752 | * @endcode
|
---|
1753 | *
|
---|
1754 | * The compiler would warn with "ISO C++ forbids casting between
|
---|
1755 | * pointer-to-function and pointer-to-object". The purpose of this warning is
|
---|
1756 | * not to bother the programmer but to point out that he is probably doing
|
---|
1757 | * something dangerous, assigning a pointer to executable code to a data object.
|
---|
1758 | */
|
---|
1759 | typedef FNRT *PFNRT;
|
---|
1760 |
|
---|
1761 | /** Variant on PFNRT that takes one pointer argument. */
|
---|
1762 | typedef DECLCALLBACKTYPE(void, FNRT1,(void *pvArg));
|
---|
1763 | /** Pointer to FNRT1. */
|
---|
1764 | typedef FNRT1 *PFNRT1;
|
---|
1765 |
|
---|
1766 | /** Millisecond interval. */
|
---|
1767 | typedef uint32_t RTMSINTERVAL;
|
---|
1768 | /** Pointer to a millisecond interval. */
|
---|
1769 | typedef RTMSINTERVAL RT_FAR *PRTMSINTERVAL;
|
---|
1770 | /** Pointer to a const millisecond interval. */
|
---|
1771 | typedef const RTMSINTERVAL RT_FAR *PCRTMSINTERVAL;
|
---|
1772 |
|
---|
1773 | /** Pointer to a time spec structure. */
|
---|
1774 | typedef struct RTTIMESPEC RT_FAR *PRTTIMESPEC;
|
---|
1775 | /** Pointer to a const time spec structure. */
|
---|
1776 | typedef const struct RTTIMESPEC RT_FAR *PCRTTIMESPEC;
|
---|
1777 |
|
---|
1778 |
|
---|
1779 |
|
---|
1780 | /** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
|
---|
1781 | * @{
|
---|
1782 | */
|
---|
1783 |
|
---|
1784 | /** Signed integer which can contain both GC and HC pointers. */
|
---|
1785 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
|
---|
1786 | typedef int32_t RTINTPTR;
|
---|
1787 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
1788 | typedef int64_t RTINTPTR;
|
---|
1789 | #else
|
---|
1790 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
1791 | #endif
|
---|
1792 | /** Pointer to signed integer which can contain both GC and HC pointers. */
|
---|
1793 | typedef RTINTPTR RT_FAR *PRTINTPTR;
|
---|
1794 | /** Pointer const to signed integer which can contain both GC and HC pointers. */
|
---|
1795 | typedef const RTINTPTR RT_FAR *PCRTINTPTR;
|
---|
1796 | /** The maximum value the RTINTPTR type can hold. */
|
---|
1797 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
|
---|
1798 | # define RTINTPTR_MAX INT32_MAX
|
---|
1799 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
1800 | # define RTINTPTR_MAX INT64_MAX
|
---|
1801 | #else
|
---|
1802 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
1803 | #endif
|
---|
1804 | /** The minimum value the RTINTPTR type can hold. */
|
---|
1805 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
|
---|
1806 | # define RTINTPTR_MIN INT32_MIN
|
---|
1807 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
1808 | # define RTINTPTR_MIN INT64_MIN
|
---|
1809 | #else
|
---|
1810 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
1811 | #endif
|
---|
1812 |
|
---|
1813 | /** Unsigned integer which can contain both GC and HC pointers. */
|
---|
1814 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
|
---|
1815 | typedef uint32_t RTUINTPTR;
|
---|
1816 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
1817 | typedef uint64_t RTUINTPTR;
|
---|
1818 | #else
|
---|
1819 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
1820 | #endif
|
---|
1821 | /** Pointer to unsigned integer which can contain both GC and HC pointers. */
|
---|
1822 | typedef RTUINTPTR RT_FAR *PRTUINTPTR;
|
---|
1823 | /** Pointer const to unsigned integer which can contain both GC and HC pointers. */
|
---|
1824 | typedef const RTUINTPTR RT_FAR *PCRTUINTPTR;
|
---|
1825 | /** The maximum value the RTUINTPTR type can hold. */
|
---|
1826 | #if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
|
---|
1827 | # define RTUINTPTR_MAX UINT32_MAX
|
---|
1828 | #elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
|
---|
1829 | # define RTUINTPTR_MAX UINT64_MAX
|
---|
1830 | #else
|
---|
1831 | # error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
|
---|
1832 | #endif
|
---|
1833 |
|
---|
1834 | /** Signed integer. */
|
---|
1835 | typedef int32_t RTINT;
|
---|
1836 | /** Pointer to signed integer. */
|
---|
1837 | typedef RTINT RT_FAR *PRTINT;
|
---|
1838 | /** Pointer to const signed integer. */
|
---|
1839 | typedef const RTINT RT_FAR *PCRTINT;
|
---|
1840 |
|
---|
1841 | /** Unsigned integer. */
|
---|
1842 | typedef uint32_t RTUINT;
|
---|
1843 | /** Pointer to unsigned integer. */
|
---|
1844 | typedef RTUINT RT_FAR *PRTUINT;
|
---|
1845 | /** Pointer to const unsigned integer. */
|
---|
1846 | typedef const RTUINT RT_FAR *PCRTUINT;
|
---|
1847 |
|
---|
1848 | /** A file offset / size (off_t). */
|
---|
1849 | typedef int64_t RTFOFF;
|
---|
1850 | /** Pointer to a file offset / size. */
|
---|
1851 | typedef RTFOFF RT_FAR *PRTFOFF;
|
---|
1852 | /** The max value for RTFOFF. */
|
---|
1853 | #define RTFOFF_MAX INT64_MAX
|
---|
1854 | /** The min value for RTFOFF. */
|
---|
1855 | #define RTFOFF_MIN INT64_MIN
|
---|
1856 |
|
---|
1857 | /** File mode (see iprt/fs.h). */
|
---|
1858 | typedef uint32_t RTFMODE;
|
---|
1859 | /** Pointer to file mode. */
|
---|
1860 | typedef RTFMODE RT_FAR *PRTFMODE;
|
---|
1861 |
|
---|
1862 | /** Device unix number. */
|
---|
1863 | typedef uint32_t RTDEV;
|
---|
1864 | /** Pointer to a device unix number. */
|
---|
1865 | typedef RTDEV RT_FAR *PRTDEV;
|
---|
1866 |
|
---|
1867 | /** @name RTDEV Macros
|
---|
1868 | * @{ */
|
---|
1869 | /**
|
---|
1870 | * Our makedev macro.
|
---|
1871 | * @returns RTDEV
|
---|
1872 | * @param uMajor The major device number.
|
---|
1873 | * @param uMinor The minor device number.
|
---|
1874 | */
|
---|
1875 | #define RTDEV_MAKE(uMajor, uMinor) ((RTDEV)( ((RTDEV)(uMajor) << 24) | (uMinor & UINT32_C(0x00ffffff)) ))
|
---|
1876 | /**
|
---|
1877 | * Get the major device node number from an RTDEV type.
|
---|
1878 | * @returns The major device number of @a uDev
|
---|
1879 | * @param uDev The device number.
|
---|
1880 | */
|
---|
1881 | #define RTDEV_MAJOR(uDev) ((uDev) >> 24)
|
---|
1882 | /**
|
---|
1883 | * Get the minor device node number from an RTDEV type.
|
---|
1884 | * @returns The minor device number of @a uDev
|
---|
1885 | * @param uDev The device number.
|
---|
1886 | */
|
---|
1887 | #define RTDEV_MINOR(uDev) ((uDev) & UINT32_C(0x00ffffff))
|
---|
1888 | /** @} */
|
---|
1889 |
|
---|
1890 | /** i-node number. */
|
---|
1891 | typedef uint64_t RTINODE;
|
---|
1892 | /** Pointer to a i-node number. */
|
---|
1893 | typedef RTINODE RT_FAR *PRTINODE;
|
---|
1894 |
|
---|
1895 | /** User id. */
|
---|
1896 | typedef uint32_t RTUID;
|
---|
1897 | /** Pointer to a user id. */
|
---|
1898 | typedef RTUID RT_FAR *PRTUID;
|
---|
1899 | /** NIL user id.
|
---|
1900 | * @todo check this for portability! */
|
---|
1901 | #define NIL_RTUID (~(RTUID)0)
|
---|
1902 |
|
---|
1903 | /** Group id. */
|
---|
1904 | typedef uint32_t RTGID;
|
---|
1905 | /** Pointer to a group id. */
|
---|
1906 | typedef RTGID RT_FAR *PRTGID;
|
---|
1907 | /** NIL group id.
|
---|
1908 | * @todo check this for portability! */
|
---|
1909 | #define NIL_RTGID (~(RTGID)0)
|
---|
1910 |
|
---|
1911 | /** I/O Port. */
|
---|
1912 | typedef uint16_t RTIOPORT;
|
---|
1913 | /** Pointer to I/O Port. */
|
---|
1914 | typedef RTIOPORT RT_FAR *PRTIOPORT;
|
---|
1915 | /** Pointer to const I/O Port. */
|
---|
1916 | typedef const RTIOPORT RT_FAR *PCRTIOPORT;
|
---|
1917 |
|
---|
1918 | /** Selector. */
|
---|
1919 | typedef uint16_t RTSEL;
|
---|
1920 | /** Pointer to selector. */
|
---|
1921 | typedef RTSEL RT_FAR *PRTSEL;
|
---|
1922 | /** Pointer to const selector. */
|
---|
1923 | typedef const RTSEL RT_FAR *PCRTSEL;
|
---|
1924 | /** Max selector value. */
|
---|
1925 | #define RTSEL_MAX UINT16_MAX
|
---|
1926 |
|
---|
1927 | /** Far 16-bit pointer. */
|
---|
1928 | #pragma pack(1)
|
---|
1929 | typedef struct RTFAR16
|
---|
1930 | {
|
---|
1931 | uint16_t off;
|
---|
1932 | RTSEL sel;
|
---|
1933 | } RTFAR16;
|
---|
1934 | #pragma pack()
|
---|
1935 | /** Pointer to Far 16-bit pointer. */
|
---|
1936 | typedef RTFAR16 RT_FAR *PRTFAR16;
|
---|
1937 | /** Pointer to const Far 16-bit pointer. */
|
---|
1938 | typedef const RTFAR16 RT_FAR *PCRTFAR16;
|
---|
1939 |
|
---|
1940 | /** Far 32-bit pointer. */
|
---|
1941 | #pragma pack(1)
|
---|
1942 | typedef struct RTFAR32
|
---|
1943 | {
|
---|
1944 | uint32_t off;
|
---|
1945 | RTSEL sel;
|
---|
1946 | } RTFAR32;
|
---|
1947 | #pragma pack()
|
---|
1948 | /** Pointer to Far 32-bit pointer. */
|
---|
1949 | typedef RTFAR32 RT_FAR *PRTFAR32;
|
---|
1950 | /** Pointer to const Far 32-bit pointer. */
|
---|
1951 | typedef const RTFAR32 RT_FAR *PCRTFAR32;
|
---|
1952 |
|
---|
1953 | /** Far 64-bit pointer. */
|
---|
1954 | #pragma pack(1)
|
---|
1955 | typedef struct RTFAR64
|
---|
1956 | {
|
---|
1957 | uint64_t off;
|
---|
1958 | RTSEL sel;
|
---|
1959 | } RTFAR64;
|
---|
1960 | #pragma pack()
|
---|
1961 | /** Pointer to Far 64-bit pointer. */
|
---|
1962 | typedef RTFAR64 RT_FAR *PRTFAR64;
|
---|
1963 | /** Pointer to const Far 64-bit pointer. */
|
---|
1964 | typedef const RTFAR64 RT_FAR *PCRTFAR64;
|
---|
1965 |
|
---|
1966 | /** @} */
|
---|
1967 |
|
---|
1968 |
|
---|
1969 | /** @defgroup grp_rt_types_hc Host Context Basic Types
|
---|
1970 | * @{
|
---|
1971 | */
|
---|
1972 |
|
---|
1973 | /** HC Natural signed integer.
|
---|
1974 | * @deprecated silly type. */
|
---|
1975 | typedef int32_t RTHCINT;
|
---|
1976 | /** Pointer to HC Natural signed integer.
|
---|
1977 | * @deprecated silly type. */
|
---|
1978 | typedef RTHCINT RT_FAR *PRTHCINT;
|
---|
1979 | /** Pointer to const HC Natural signed integer.
|
---|
1980 | * @deprecated silly type. */
|
---|
1981 | typedef const RTHCINT RT_FAR *PCRTHCINT;
|
---|
1982 |
|
---|
1983 | /** HC Natural unsigned integer.
|
---|
1984 | * @deprecated silly type. */
|
---|
1985 | typedef uint32_t RTHCUINT;
|
---|
1986 | /** Pointer to HC Natural unsigned integer.
|
---|
1987 | * @deprecated silly type. */
|
---|
1988 | typedef RTHCUINT RT_FAR *PRTHCUINT;
|
---|
1989 | /** Pointer to const HC Natural unsigned integer.
|
---|
1990 | * @deprecated silly type. */
|
---|
1991 | typedef const RTHCUINT RT_FAR *PCRTHCUINT;
|
---|
1992 |
|
---|
1993 |
|
---|
1994 | /** Signed integer which can contain a HC pointer. */
|
---|
1995 | #if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
|
---|
1996 | typedef int32_t RTHCINTPTR;
|
---|
1997 | #elif HC_ARCH_BITS == 64
|
---|
1998 | typedef int64_t RTHCINTPTR;
|
---|
1999 | #else
|
---|
2000 | # error Unsupported HC_ARCH_BITS value.
|
---|
2001 | #endif
|
---|
2002 | /** Pointer to signed integer which can contain a HC pointer. */
|
---|
2003 | typedef RTHCINTPTR RT_FAR *PRTHCINTPTR;
|
---|
2004 | /** Pointer to const signed integer which can contain a HC pointer. */
|
---|
2005 | typedef const RTHCINTPTR RT_FAR *PCRTHCINTPTR;
|
---|
2006 | /** Max RTHCINTPTR value. */
|
---|
2007 | #if HC_ARCH_BITS == 32
|
---|
2008 | # define RTHCINTPTR_MAX INT32_MAX
|
---|
2009 | #elif HC_ARCH_BITS == 64
|
---|
2010 | # define RTHCINTPTR_MAX INT64_MAX
|
---|
2011 | #else
|
---|
2012 | # define RTHCINTPTR_MAX INT16_MAX
|
---|
2013 | #endif
|
---|
2014 | /** Min RTHCINTPTR value. */
|
---|
2015 | #if HC_ARCH_BITS == 32
|
---|
2016 | # define RTHCINTPTR_MIN INT32_MIN
|
---|
2017 | #elif HC_ARCH_BITS == 64
|
---|
2018 | # define RTHCINTPTR_MIN INT64_MIN
|
---|
2019 | #else
|
---|
2020 | # define RTHCINTPTR_MIN INT16_MIN
|
---|
2021 | #endif
|
---|
2022 |
|
---|
2023 | /** Signed integer which can contain a HC ring-3 pointer. */
|
---|
2024 | #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
|
---|
2025 | typedef int32_t RTR3INTPTR;
|
---|
2026 | #elif R3_ARCH_BITS == 64
|
---|
2027 | typedef int64_t RTR3INTPTR;
|
---|
2028 | #else
|
---|
2029 | # error Unsupported R3_ARCH_BITS value.
|
---|
2030 | #endif
|
---|
2031 | /** Pointer to signed integer which can contain a HC ring-3 pointer. */
|
---|
2032 | typedef RTR3INTPTR RT_FAR *PRTR3INTPTR;
|
---|
2033 | /** Pointer to const signed integer which can contain a HC ring-3 pointer. */
|
---|
2034 | typedef const RTR3INTPTR RT_FAR *PCRTR3INTPTR;
|
---|
2035 | /** Max RTR3INTPTR value. */
|
---|
2036 | #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
|
---|
2037 | # define RTR3INTPTR_MAX INT32_MAX
|
---|
2038 | #else
|
---|
2039 | # define RTR3INTPTR_MAX INT64_MAX
|
---|
2040 | #endif
|
---|
2041 | /** Min RTR3INTPTR value. */
|
---|
2042 | #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
|
---|
2043 | # define RTR3INTPTR_MIN INT32_MIN
|
---|
2044 | #else
|
---|
2045 | # define RTR3INTPTR_MIN INT64_MIN
|
---|
2046 | #endif
|
---|
2047 |
|
---|
2048 | /** Signed integer which can contain a HC ring-0 pointer. */
|
---|
2049 | #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
|
---|
2050 | typedef int32_t RTR0INTPTR;
|
---|
2051 | #elif R0_ARCH_BITS == 64
|
---|
2052 | typedef int64_t RTR0INTPTR;
|
---|
2053 | #else
|
---|
2054 | # error Unsupported R0_ARCH_BITS value.
|
---|
2055 | #endif
|
---|
2056 | /** Pointer to signed integer which can contain a HC ring-0 pointer. */
|
---|
2057 | typedef RTR0INTPTR RT_FAR *PRTR0INTPTR;
|
---|
2058 | /** Pointer to const signed integer which can contain a HC ring-0 pointer. */
|
---|
2059 | typedef const RTR0INTPTR RT_FAR *PCRTR0INTPTR;
|
---|
2060 | /** Max RTR0INTPTR value. */
|
---|
2061 | #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
|
---|
2062 | # define RTR0INTPTR_MAX INT32_MAX
|
---|
2063 | #else
|
---|
2064 | # define RTR0INTPTR_MAX INT64_MAX
|
---|
2065 | #endif
|
---|
2066 | /** Min RTHCINTPTR value. */
|
---|
2067 | #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
|
---|
2068 | # define RTR0INTPTR_MIN INT32_MIN
|
---|
2069 | #else
|
---|
2070 | # define RTR0INTPTR_MIN INT64_MIN
|
---|
2071 | #endif
|
---|
2072 |
|
---|
2073 |
|
---|
2074 | /** Unsigned integer which can contain a HC pointer. */
|
---|
2075 | #if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
|
---|
2076 | typedef uint32_t RTHCUINTPTR;
|
---|
2077 | #elif HC_ARCH_BITS == 64
|
---|
2078 | typedef uint64_t RTHCUINTPTR;
|
---|
2079 | #else
|
---|
2080 | # error Unsupported HC_ARCH_BITS value.
|
---|
2081 | #endif
|
---|
2082 | /** Pointer to unsigned integer which can contain a HC pointer. */
|
---|
2083 | typedef RTHCUINTPTR RT_FAR *PRTHCUINTPTR;
|
---|
2084 | /** Pointer to unsigned integer which can contain a HC pointer. */
|
---|
2085 | typedef const RTHCUINTPTR RT_FAR *PCRTHCUINTPTR;
|
---|
2086 | /** Max RTHCUINTTPR value. */
|
---|
2087 | #if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
|
---|
2088 | # define RTHCUINTPTR_MAX UINT32_MAX
|
---|
2089 | #else
|
---|
2090 | # define RTHCUINTPTR_MAX UINT64_MAX
|
---|
2091 | #endif
|
---|
2092 |
|
---|
2093 | /** Unsigned integer which can contain a HC ring-3 pointer. */
|
---|
2094 | #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
|
---|
2095 | typedef uint32_t RTR3UINTPTR;
|
---|
2096 | #elif R3_ARCH_BITS == 64
|
---|
2097 | typedef uint64_t RTR3UINTPTR;
|
---|
2098 | #else
|
---|
2099 | # error Unsupported R3_ARCH_BITS value.
|
---|
2100 | #endif
|
---|
2101 | /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
|
---|
2102 | typedef RTR3UINTPTR RT_FAR *PRTR3UINTPTR;
|
---|
2103 | /** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
|
---|
2104 | typedef const RTR3UINTPTR RT_FAR *PCRTR3UINTPTR;
|
---|
2105 | /** Max RTHCUINTTPR value. */
|
---|
2106 | #if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
|
---|
2107 | # define RTR3UINTPTR_MAX UINT32_MAX
|
---|
2108 | #else
|
---|
2109 | # define RTR3UINTPTR_MAX UINT64_MAX
|
---|
2110 | #endif
|
---|
2111 |
|
---|
2112 | /** Unsigned integer which can contain a HC ring-0 pointer. */
|
---|
2113 | #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
|
---|
2114 | typedef uint32_t RTR0UINTPTR;
|
---|
2115 | #elif R0_ARCH_BITS == 64
|
---|
2116 | typedef uint64_t RTR0UINTPTR;
|
---|
2117 | #else
|
---|
2118 | # error Unsupported R0_ARCH_BITS value.
|
---|
2119 | #endif
|
---|
2120 | /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
|
---|
2121 | typedef RTR0UINTPTR RT_FAR *PRTR0UINTPTR;
|
---|
2122 | /** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
|
---|
2123 | typedef const RTR0UINTPTR RT_FAR *PCRTR0UINTPTR;
|
---|
2124 | /** Max RTR0UINTTPR value. */
|
---|
2125 | #if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
|
---|
2126 | # define RTR0UINTPTR_MAX UINT32_MAX
|
---|
2127 | #else
|
---|
2128 | # define RTR0UINTPTR_MAX UINT64_MAX
|
---|
2129 | #endif
|
---|
2130 |
|
---|
2131 |
|
---|
2132 | /** Host Physical Memory Address. */
|
---|
2133 | typedef uint64_t RTHCPHYS;
|
---|
2134 | /** Pointer to Host Physical Memory Address. */
|
---|
2135 | typedef RTHCPHYS RT_FAR *PRTHCPHYS;
|
---|
2136 | /** Pointer to const Host Physical Memory Address. */
|
---|
2137 | typedef const RTHCPHYS RT_FAR *PCRTHCPHYS;
|
---|
2138 | /** @def NIL_RTHCPHYS
|
---|
2139 | * NIL HC Physical Address.
|
---|
2140 | * NIL_RTHCPHYS is used to signal an invalid physical address, similar
|
---|
2141 | * to the NULL pointer.
|
---|
2142 | */
|
---|
2143 | #define NIL_RTHCPHYS (~(RTHCPHYS)0)
|
---|
2144 | /** Max RTHCPHYS value. */
|
---|
2145 | #define RTHCPHYS_MAX UINT64_MAX
|
---|
2146 |
|
---|
2147 |
|
---|
2148 | /** HC pointer. */
|
---|
2149 | #if !defined(IN_RC) || defined(DOXYGEN_RUNNING)
|
---|
2150 | typedef void RT_FAR *RTHCPTR;
|
---|
2151 | #else
|
---|
2152 | typedef RTHCUINTPTR RTHCPTR;
|
---|
2153 | #endif
|
---|
2154 | /** Pointer to HC pointer. */
|
---|
2155 | typedef RTHCPTR RT_FAR *PRTHCPTR;
|
---|
2156 | /** Pointer to const HC pointer. */
|
---|
2157 | typedef const RTHCPTR *PCRTHCPTR;
|
---|
2158 | /** @def NIL_RTHCPTR
|
---|
2159 | * NIL HC pointer.
|
---|
2160 | */
|
---|
2161 | #define NIL_RTHCPTR ((RTHCPTR)0)
|
---|
2162 | /** Max RTHCPTR value. */
|
---|
2163 | #define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
|
---|
2164 |
|
---|
2165 |
|
---|
2166 | /** HC ring-3 pointer. */
|
---|
2167 | #ifdef IN_RING3
|
---|
2168 | typedef void RT_FAR *RTR3PTR;
|
---|
2169 | #else
|
---|
2170 | typedef RTR3UINTPTR RTR3PTR;
|
---|
2171 | #endif
|
---|
2172 | /** Pointer to HC ring-3 pointer. */
|
---|
2173 | typedef RTR3PTR RT_FAR *PRTR3PTR;
|
---|
2174 | /** Pointer to const HC ring-3 pointer. */
|
---|
2175 | typedef const RTR3PTR *PCRTR3PTR;
|
---|
2176 | /** @def NIL_RTR3PTR
|
---|
2177 | * NIL HC ring-3 pointer.
|
---|
2178 | */
|
---|
2179 | #ifndef IN_RING3
|
---|
2180 | # define NIL_RTR3PTR ((RTR3PTR)0)
|
---|
2181 | #else
|
---|
2182 | # define NIL_RTR3PTR (NULL)
|
---|
2183 | #endif
|
---|
2184 | /** Max RTR3PTR value. */
|
---|
2185 | #define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
|
---|
2186 |
|
---|
2187 | /** HC ring-0 pointer. */
|
---|
2188 | #ifdef IN_RING0
|
---|
2189 | typedef void RT_FAR *RTR0PTR;
|
---|
2190 | #else
|
---|
2191 | typedef RTR0UINTPTR RTR0PTR;
|
---|
2192 | #endif
|
---|
2193 | /** Pointer to HC ring-0 pointer. */
|
---|
2194 | typedef RTR0PTR RT_FAR *PRTR0PTR;
|
---|
2195 | /** Pointer to const HC ring-0 pointer. */
|
---|
2196 | typedef const RTR0PTR *PCRTR0PTR;
|
---|
2197 | /** @def NIL_RTR0PTR
|
---|
2198 | * NIL HC ring-0 pointer.
|
---|
2199 | */
|
---|
2200 | #ifndef IN_RING0
|
---|
2201 | # define NIL_RTR0PTR ((RTR0PTR)0)
|
---|
2202 | #else
|
---|
2203 | # define NIL_RTR0PTR (NULL)
|
---|
2204 | #endif
|
---|
2205 | /** Max RTR3PTR value. */
|
---|
2206 | #define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
|
---|
2207 |
|
---|
2208 |
|
---|
2209 | /** Unsigned integer register in the host context. */
|
---|
2210 | #if HC_ARCH_BITS == 32
|
---|
2211 | typedef uint32_t RTHCUINTREG;
|
---|
2212 | #elif HC_ARCH_BITS == 64
|
---|
2213 | typedef uint64_t RTHCUINTREG;
|
---|
2214 | #elif HC_ARCH_BITS == 16
|
---|
2215 | typedef uint16_t RTHCUINTREG;
|
---|
2216 | #else
|
---|
2217 | # error "Unsupported HC_ARCH_BITS!"
|
---|
2218 | #endif
|
---|
2219 | /** Pointer to an unsigned integer register in the host context. */
|
---|
2220 | typedef RTHCUINTREG RT_FAR *PRTHCUINTREG;
|
---|
2221 | /** Pointer to a const unsigned integer register in the host context. */
|
---|
2222 | typedef const RTHCUINTREG RT_FAR *PCRTHCUINTREG;
|
---|
2223 |
|
---|
2224 | /** Unsigned integer register in the host ring-3 context. */
|
---|
2225 | #if R3_ARCH_BITS == 32
|
---|
2226 | typedef uint32_t RTR3UINTREG;
|
---|
2227 | #elif R3_ARCH_BITS == 64
|
---|
2228 | typedef uint64_t RTR3UINTREG;
|
---|
2229 | #elif R3_ARCH_BITS == 16
|
---|
2230 | typedef uint16_t RTR3UINTREG;
|
---|
2231 | #else
|
---|
2232 | # error "Unsupported R3_ARCH_BITS!"
|
---|
2233 | #endif
|
---|
2234 | /** Pointer to an unsigned integer register in the host ring-3 context. */
|
---|
2235 | typedef RTR3UINTREG RT_FAR *PRTR3UINTREG;
|
---|
2236 | /** Pointer to a const unsigned integer register in the host ring-3 context. */
|
---|
2237 | typedef const RTR3UINTREG RT_FAR *PCRTR3UINTREG;
|
---|
2238 |
|
---|
2239 | /** Unsigned integer register in the host ring-3 context. */
|
---|
2240 | #if R0_ARCH_BITS == 32
|
---|
2241 | typedef uint32_t RTR0UINTREG;
|
---|
2242 | #elif R0_ARCH_BITS == 64
|
---|
2243 | typedef uint64_t RTR0UINTREG;
|
---|
2244 | #elif R0_ARCH_BITS == 16
|
---|
2245 | typedef uint16_t RTR0UINTREG;
|
---|
2246 | #else
|
---|
2247 | # error "Unsupported R3_ARCH_BITS!"
|
---|
2248 | #endif
|
---|
2249 | /** Pointer to an unsigned integer register in the host ring-3 context. */
|
---|
2250 | typedef RTR0UINTREG RT_FAR *PRTR0UINTREG;
|
---|
2251 | /** Pointer to a const unsigned integer register in the host ring-3 context. */
|
---|
2252 | typedef const RTR0UINTREG RT_FAR *PCRTR0UINTREG;
|
---|
2253 |
|
---|
2254 | /** @} */
|
---|
2255 |
|
---|
2256 |
|
---|
2257 | /** @defgroup grp_rt_types_gc Guest Context Basic Types
|
---|
2258 | * @{
|
---|
2259 | */
|
---|
2260 |
|
---|
2261 | /** Natural signed integer in the GC.
|
---|
2262 | * @deprecated silly type. */
|
---|
2263 | #if GC_ARCH_BITS == 32
|
---|
2264 | typedef int32_t RTGCINT;
|
---|
2265 | #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
|
---|
2266 | typedef int64_t RTGCINT;
|
---|
2267 | #endif
|
---|
2268 | /** Pointer to natural signed integer in GC.
|
---|
2269 | * @deprecated silly type. */
|
---|
2270 | typedef RTGCINT RT_FAR *PRTGCINT;
|
---|
2271 | /** Pointer to const natural signed integer in GC.
|
---|
2272 | * @deprecated silly type. */
|
---|
2273 | typedef const RTGCINT RT_FAR *PCRTGCINT;
|
---|
2274 |
|
---|
2275 | /** Natural unsigned integer in the GC.
|
---|
2276 | * @deprecated silly type. */
|
---|
2277 | #if GC_ARCH_BITS == 32
|
---|
2278 | typedef uint32_t RTGCUINT;
|
---|
2279 | #elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
|
---|
2280 | typedef uint64_t RTGCUINT;
|
---|
2281 | #endif
|
---|
2282 | /** Pointer to natural unsigned integer in GC.
|
---|
2283 | * @deprecated silly type. */
|
---|
2284 | typedef RTGCUINT RT_FAR *PRTGCUINT;
|
---|
2285 | /** Pointer to const natural unsigned integer in GC.
|
---|
2286 | * @deprecated silly type. */
|
---|
2287 | typedef const RTGCUINT RT_FAR *PCRTGCUINT;
|
---|
2288 |
|
---|
2289 | /** Signed integer which can contain a GC pointer. */
|
---|
2290 | #if GC_ARCH_BITS == 32
|
---|
2291 | typedef int32_t RTGCINTPTR;
|
---|
2292 | #elif GC_ARCH_BITS == 64
|
---|
2293 | typedef int64_t RTGCINTPTR;
|
---|
2294 | #endif
|
---|
2295 | /** Pointer to signed integer which can contain a GC pointer. */
|
---|
2296 | typedef RTGCINTPTR RT_FAR *PRTGCINTPTR;
|
---|
2297 | /** Pointer to const signed integer which can contain a GC pointer. */
|
---|
2298 | typedef const RTGCINTPTR RT_FAR *PCRTGCINTPTR;
|
---|
2299 |
|
---|
2300 | /** Unsigned integer which can contain a GC pointer. */
|
---|
2301 | #if GC_ARCH_BITS == 32
|
---|
2302 | typedef uint32_t RTGCUINTPTR;
|
---|
2303 | #elif GC_ARCH_BITS == 64
|
---|
2304 | typedef uint64_t RTGCUINTPTR;
|
---|
2305 | #else
|
---|
2306 | # error Unsupported GC_ARCH_BITS value.
|
---|
2307 | #endif
|
---|
2308 | /** Pointer to unsigned integer which can contain a GC pointer. */
|
---|
2309 | typedef RTGCUINTPTR RT_FAR *PRTGCUINTPTR;
|
---|
2310 | /** Pointer to unsigned integer which can contain a GC pointer. */
|
---|
2311 | typedef const RTGCUINTPTR RT_FAR *PCRTGCUINTPTR;
|
---|
2312 |
|
---|
2313 | /** Unsigned integer which can contain a 32 bits GC pointer. */
|
---|
2314 | typedef uint32_t RTGCUINTPTR32;
|
---|
2315 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
2316 | typedef RTGCUINTPTR32 RT_FAR *PRTGCUINTPTR32;
|
---|
2317 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
2318 | typedef const RTGCUINTPTR32 RT_FAR *PCRTGCUINTPTR32;
|
---|
2319 |
|
---|
2320 | /** Unsigned integer which can contain a 64 bits GC pointer. */
|
---|
2321 | typedef uint64_t RTGCUINTPTR64;
|
---|
2322 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
2323 | typedef RTGCUINTPTR64 RT_FAR *PRTGCUINTPTR64;
|
---|
2324 | /** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
|
---|
2325 | typedef const RTGCUINTPTR64 RT_FAR *PCRTGCUINTPTR64;
|
---|
2326 |
|
---|
2327 | /** Guest Physical Memory Address.*/
|
---|
2328 | typedef uint64_t RTGCPHYS;
|
---|
2329 | /** Pointer to Guest Physical Memory Address. */
|
---|
2330 | typedef RTGCPHYS RT_FAR *PRTGCPHYS;
|
---|
2331 | /** Pointer to const Guest Physical Memory Address. */
|
---|
2332 | typedef const RTGCPHYS RT_FAR *PCRTGCPHYS;
|
---|
2333 | /** @def NIL_RTGCPHYS
|
---|
2334 | * NIL GC Physical Address.
|
---|
2335 | * NIL_RTGCPHYS is used to signal an invalid physical address, similar
|
---|
2336 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
2337 | * some contexts.
|
---|
2338 | */
|
---|
2339 | #define NIL_RTGCPHYS (~(RTGCPHYS)0U)
|
---|
2340 | /** Max guest physical memory address value. */
|
---|
2341 | #define RTGCPHYS_MAX UINT64_MAX
|
---|
2342 |
|
---|
2343 |
|
---|
2344 | /** Guest Physical Memory Address; limited to 32 bits.*/
|
---|
2345 | typedef uint32_t RTGCPHYS32;
|
---|
2346 | /** Pointer to Guest Physical Memory Address. */
|
---|
2347 | typedef RTGCPHYS32 RT_FAR *PRTGCPHYS32;
|
---|
2348 | /** Pointer to const Guest Physical Memory Address. */
|
---|
2349 | typedef const RTGCPHYS32 RT_FAR *PCRTGCPHYS32;
|
---|
2350 | /** @def NIL_RTGCPHYS32
|
---|
2351 | * NIL GC Physical Address.
|
---|
2352 | * NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
|
---|
2353 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
2354 | * some contexts.
|
---|
2355 | */
|
---|
2356 | #define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
|
---|
2357 |
|
---|
2358 |
|
---|
2359 | /** Guest Physical Memory Address; limited to 64 bits.*/
|
---|
2360 | typedef uint64_t RTGCPHYS64;
|
---|
2361 | /** Pointer to Guest Physical Memory Address. */
|
---|
2362 | typedef RTGCPHYS64 RT_FAR *PRTGCPHYS64;
|
---|
2363 | /** Pointer to const Guest Physical Memory Address. */
|
---|
2364 | typedef const RTGCPHYS64 RT_FAR *PCRTGCPHYS64;
|
---|
2365 | /** @def NIL_RTGCPHYS64
|
---|
2366 | * NIL GC Physical Address.
|
---|
2367 | * NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
|
---|
2368 | * to the NULL pointer. Note that this value may actually be valid in
|
---|
2369 | * some contexts.
|
---|
2370 | */
|
---|
2371 | #define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
|
---|
2372 |
|
---|
2373 | /** Guest context pointer, 32 bits.
|
---|
2374 | * Keep in mind that this type is an unsigned integer in
|
---|
2375 | * HC and void pointer in GC.
|
---|
2376 | */
|
---|
2377 | typedef RTGCUINTPTR32 RTGCPTR32;
|
---|
2378 | /** Pointer to a guest context pointer. */
|
---|
2379 | typedef RTGCPTR32 RT_FAR *PRTGCPTR32;
|
---|
2380 | /** Pointer to a const guest context pointer. */
|
---|
2381 | typedef const RTGCPTR32 RT_FAR *PCRTGCPTR32;
|
---|
2382 | /** @def NIL_RTGCPTR32
|
---|
2383 | * NIL GC pointer.
|
---|
2384 | */
|
---|
2385 | #define NIL_RTGCPTR32 ((RTGCPTR32)0)
|
---|
2386 |
|
---|
2387 | /** Guest context pointer, 64 bits.
|
---|
2388 | */
|
---|
2389 | typedef RTGCUINTPTR64 RTGCPTR64;
|
---|
2390 | /** Pointer to a guest context pointer. */
|
---|
2391 | typedef RTGCPTR64 RT_FAR *PRTGCPTR64;
|
---|
2392 | /** Pointer to a const guest context pointer. */
|
---|
2393 | typedef const RTGCPTR64 RT_FAR *PCRTGCPTR64;
|
---|
2394 | /** @def NIL_RTGCPTR64
|
---|
2395 | * NIL GC pointer.
|
---|
2396 | */
|
---|
2397 | #define NIL_RTGCPTR64 ((RTGCPTR64)0)
|
---|
2398 |
|
---|
2399 | /** @typedef RTGCPTR
|
---|
2400 | * Guest context pointer.
|
---|
2401 | * Keep in mind that this type is an unsigned integer in HC and void pointer in GC. */
|
---|
2402 | /** @typedef PRTGCPTR
|
---|
2403 | * Pointer to a guest context pointer. */
|
---|
2404 | /** @typedef PCRTGCPTR
|
---|
2405 | * Pointer to a const guest context pointer. */
|
---|
2406 | /** @def NIL_RTGCPTR
|
---|
2407 | * NIL GC pointer. */
|
---|
2408 | /** @def RTGCPTR_MAX
|
---|
2409 | * Max RTGCPTR value. */
|
---|
2410 | #if GC_ARCH_BITS == 64 || defined(DOXYGEN_RUNNING)
|
---|
2411 | typedef RTGCPTR64 RTGCPTR;
|
---|
2412 | typedef PRTGCPTR64 PRTGCPTR;
|
---|
2413 | typedef PCRTGCPTR64 PCRTGCPTR;
|
---|
2414 | # define NIL_RTGCPTR NIL_RTGCPTR64
|
---|
2415 | # define RTGCPTR_MAX UINT64_MAX
|
---|
2416 | #elif GC_ARCH_BITS == 32
|
---|
2417 | typedef RTGCPTR32 RTGCPTR;
|
---|
2418 | typedef PRTGCPTR32 PRTGCPTR;
|
---|
2419 | typedef PCRTGCPTR32 PCRTGCPTR;
|
---|
2420 | # define NIL_RTGCPTR NIL_RTGCPTR32
|
---|
2421 | # define RTGCPTR_MAX UINT32_MAX
|
---|
2422 | #else
|
---|
2423 | # error "Unsupported GC_ARCH_BITS!"
|
---|
2424 | #endif
|
---|
2425 |
|
---|
2426 | /** Unsigned integer register in the guest context. */
|
---|
2427 | typedef uint32_t RTGCUINTREG32;
|
---|
2428 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
2429 | typedef RTGCUINTREG32 RT_FAR *PRTGCUINTREG32;
|
---|
2430 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
2431 | typedef const RTGCUINTREG32 RT_FAR *PCRTGCUINTREG32;
|
---|
2432 |
|
---|
2433 | typedef uint64_t RTGCUINTREG64;
|
---|
2434 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
2435 | typedef RTGCUINTREG64 RT_FAR *PRTGCUINTREG64;
|
---|
2436 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
2437 | typedef const RTGCUINTREG64 RT_FAR *PCRTGCUINTREG64;
|
---|
2438 |
|
---|
2439 | #if GC_ARCH_BITS == 64
|
---|
2440 | typedef RTGCUINTREG64 RTGCUINTREG;
|
---|
2441 | #elif GC_ARCH_BITS == 32
|
---|
2442 | typedef RTGCUINTREG32 RTGCUINTREG;
|
---|
2443 | #else
|
---|
2444 | # error "Unsupported GC_ARCH_BITS!"
|
---|
2445 | #endif
|
---|
2446 | /** Pointer to an unsigned integer register in the guest context. */
|
---|
2447 | typedef RTGCUINTREG RT_FAR *PRTGCUINTREG;
|
---|
2448 | /** Pointer to a const unsigned integer register in the guest context. */
|
---|
2449 | typedef const RTGCUINTREG RT_FAR *PCRTGCUINTREG;
|
---|
2450 |
|
---|
2451 | /** @} */
|
---|
2452 |
|
---|
2453 | /** @defgroup grp_rt_types_rc Raw mode Context Basic Types
|
---|
2454 | * @{
|
---|
2455 | */
|
---|
2456 |
|
---|
2457 | /** Raw mode context pointer; a 32 bits guest context pointer.
|
---|
2458 | * Keep in mind that this type is an unsigned integer in
|
---|
2459 | * HC and void pointer in RC.
|
---|
2460 | */
|
---|
2461 | #ifdef IN_RC
|
---|
2462 | typedef void RT_FAR *RTRCPTR;
|
---|
2463 | #else
|
---|
2464 | typedef uint32_t RTRCPTR;
|
---|
2465 | #endif
|
---|
2466 | /** Pointer to a raw mode context pointer. */
|
---|
2467 | typedef RTRCPTR RT_FAR *PRTRCPTR;
|
---|
2468 | /** Pointer to a const raw mode context pointer. */
|
---|
2469 | typedef const RTRCPTR RT_FAR *PCRTRCPTR;
|
---|
2470 | /** @def NIL_RTRCPTR
|
---|
2471 | * NIL RC pointer. */
|
---|
2472 | #ifdef IN_RC
|
---|
2473 | # define NIL_RTRCPTR (NULL)
|
---|
2474 | #else
|
---|
2475 | # define NIL_RTRCPTR ((RTRCPTR)0)
|
---|
2476 | #endif
|
---|
2477 | /** @def RTRCPTR_MAX
|
---|
2478 | * The maximum value a RTRCPTR can have. Mostly used as INVALID value.
|
---|
2479 | */
|
---|
2480 | #define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
|
---|
2481 |
|
---|
2482 | /** Raw mode context pointer, unsigned integer variant. */
|
---|
2483 | typedef int32_t RTRCINTPTR;
|
---|
2484 | /** @def RTRCUINTPTR_MAX
|
---|
2485 | * The maximum value a RTRCUINPTR can have.
|
---|
2486 | */
|
---|
2487 | #define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
|
---|
2488 |
|
---|
2489 | /** Raw mode context pointer, signed integer variant. */
|
---|
2490 | typedef uint32_t RTRCUINTPTR;
|
---|
2491 | /** @def RTRCINTPTR_MIN
|
---|
2492 | * The minimum value a RTRCINPTR can have.
|
---|
2493 | */
|
---|
2494 | #define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
|
---|
2495 | /** @def RTRCINTPTR_MAX
|
---|
2496 | * The maximum value a RTRCINPTR can have.
|
---|
2497 | */
|
---|
2498 | #define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
|
---|
2499 |
|
---|
2500 | /* The following are only temporarily while we clean up RTRCPTR usage: */
|
---|
2501 | #ifdef IN_RC
|
---|
2502 | typedef void RT_FAR *RTRGPTR;
|
---|
2503 | #else
|
---|
2504 | typedef uint64_t RTRGPTR;
|
---|
2505 | #endif
|
---|
2506 | typedef RTRGPTR RT_FAR *PRTRGPTR;
|
---|
2507 | typedef const RTRGPTR RT_FAR *PCRTRGPTR;
|
---|
2508 | #ifdef IN_RC
|
---|
2509 | # define NIL_RTRGPTR (NULL)
|
---|
2510 | #else
|
---|
2511 | # define NIL_RTRGPTR ((RTRGPTR)0)
|
---|
2512 | #endif
|
---|
2513 |
|
---|
2514 | /** @} */
|
---|
2515 |
|
---|
2516 |
|
---|
2517 | /** @defgroup grp_rt_types_cc Current Context Basic Types
|
---|
2518 | * @{
|
---|
2519 | */
|
---|
2520 |
|
---|
2521 | /** Current Context Physical Memory Address.*/
|
---|
2522 | #ifdef IN_RC
|
---|
2523 | typedef RTGCPHYS RTCCPHYS;
|
---|
2524 | #else
|
---|
2525 | typedef RTHCPHYS RTCCPHYS;
|
---|
2526 | #endif
|
---|
2527 | /** Pointer to Current Context Physical Memory Address. */
|
---|
2528 | typedef RTCCPHYS RT_FAR *PRTCCPHYS;
|
---|
2529 | /** Pointer to const Current Context Physical Memory Address. */
|
---|
2530 | typedef const RTCCPHYS RT_FAR *PCRTCCPHYS;
|
---|
2531 | /** @def NIL_RTCCPHYS
|
---|
2532 | * NIL CC Physical Address.
|
---|
2533 | * NIL_RTCCPHYS is used to signal an invalid physical address, similar
|
---|
2534 | * to the NULL pointer.
|
---|
2535 | */
|
---|
2536 | #ifdef IN_RC
|
---|
2537 | # define NIL_RTCCPHYS NIL_RTGCPHYS
|
---|
2538 | #else
|
---|
2539 | # define NIL_RTCCPHYS NIL_RTHCPHYS
|
---|
2540 | #endif
|
---|
2541 |
|
---|
2542 | /** Unsigned integer register in the current context. */
|
---|
2543 | #if ARCH_BITS == 32
|
---|
2544 | typedef uint32_t RTCCUINTREG;
|
---|
2545 | #elif ARCH_BITS == 64
|
---|
2546 | typedef uint64_t RTCCUINTREG;
|
---|
2547 | #elif ARCH_BITS == 16
|
---|
2548 | typedef uint16_t RTCCUINTREG;
|
---|
2549 | #else
|
---|
2550 | # error "Unsupported ARCH_BITS!"
|
---|
2551 | #endif
|
---|
2552 | /** Pointer to an unsigned integer register in the current context. */
|
---|
2553 | typedef RTCCUINTREG RT_FAR *PRTCCUINTREG;
|
---|
2554 | /** Pointer to a const unsigned integer register in the current context. */
|
---|
2555 | typedef RTCCUINTREG const RT_FAR *PCRTCCUINTREG;
|
---|
2556 |
|
---|
2557 | /** Signed integer register in the current context. */
|
---|
2558 | #if ARCH_BITS == 32
|
---|
2559 | typedef int32_t RTCCINTREG;
|
---|
2560 | #elif ARCH_BITS == 64
|
---|
2561 | typedef int64_t RTCCINTREG;
|
---|
2562 | #elif ARCH_BITS == 16
|
---|
2563 | typedef int16_t RTCCINTREG;
|
---|
2564 | #endif
|
---|
2565 | /** Pointer to a signed integer register in the current context. */
|
---|
2566 | typedef RTCCINTREG RT_FAR *PRTCCINTREG;
|
---|
2567 | /** Pointer to a const signed integer register in the current context. */
|
---|
2568 | typedef RTCCINTREG const RT_FAR *PCRTCCINTREG;
|
---|
2569 |
|
---|
2570 | /** Unsigned integer register in the current context.
|
---|
2571 | * @remarks This is for dealing with EAX in 16-bit mode. */
|
---|
2572 | #if ARCH_BITS == 16 && defined(RT_ARCH_X86)
|
---|
2573 | typedef uint32_t RTCCUINTXREG;
|
---|
2574 | #else
|
---|
2575 | typedef RTCCUINTREG RTCCUINTXREG;
|
---|
2576 | #endif
|
---|
2577 | /** Pointer to an unsigned integer register in the current context. */
|
---|
2578 | typedef RTCCUINTREG RT_FAR *PRTCCUINTXREG;
|
---|
2579 | /** Pointer to a const unsigned integer register in the current context. */
|
---|
2580 | typedef RTCCUINTREG const RT_FAR *PCRTCCUINTXREG;
|
---|
2581 |
|
---|
2582 | /** Signed integer extended register in the current context.
|
---|
2583 | * @remarks This is for dealing with EAX in 16-bit mode. */
|
---|
2584 | #if ARCH_BITS == 16 && defined(RT_ARCH_X86)
|
---|
2585 | typedef int32_t RTCCINTXREG;
|
---|
2586 | #else
|
---|
2587 | typedef RTCCINTREG RTCCINTXREG;
|
---|
2588 | #endif
|
---|
2589 | /** Pointer to a signed integer extended register in the current context. */
|
---|
2590 | typedef RTCCINTXREG RT_FAR *PRTCCINTXREG;
|
---|
2591 | /** Pointer to a const signed integer extended register in the current
|
---|
2592 | * context. */
|
---|
2593 | typedef RTCCINTXREG const RT_FAR *PCRTCCINTXREG;
|
---|
2594 |
|
---|
2595 | /** @def RTCCUINTREG_C
|
---|
2596 | * Defines a constant of RTCCUINTREG type.
|
---|
2597 | * @param a_Value Constant value */
|
---|
2598 | /** @def RTCCUINTREG_MAX
|
---|
2599 | * Max value that RTCCUINTREG can hold. */
|
---|
2600 | /** @def RTCCUINTREG_FMT
|
---|
2601 | * Generic IPRT format specifier for RTCCUINTREG. */
|
---|
2602 | /** @def RTCCUINTREG_XFMT
|
---|
2603 | * Generic IPRT format specifier for RTCCUINTREG, hexadecimal. */
|
---|
2604 | /** @def RTCCINTREG_C
|
---|
2605 | * Defines a constant of RTCCINTREG type.
|
---|
2606 | * @param a_Value Constant value */
|
---|
2607 | /** @def RTCCINTREG_MAX
|
---|
2608 | * Max value that RTCCINTREG can hold. */
|
---|
2609 | /** @def RTCCINTREG_MIN
|
---|
2610 | * Min value that RTCCINTREG can hold. */
|
---|
2611 | /** @def RTCCINTREG_XFMT
|
---|
2612 | * Generic IPRT format specifier for RTCCINTREG, hexadecimal. */
|
---|
2613 | #if ARCH_BITS == 32
|
---|
2614 | # define RTCCUINTREG_C(a_Value) UINT32_C(a_Value)
|
---|
2615 | # define RTCCUINTREG_MAX UINT32_MAX
|
---|
2616 | # define RTCCUINTREG_FMT "RU32"
|
---|
2617 | # define RTCCUINTREG_XFMT "RX32"
|
---|
2618 | # define RTCCINTREG_C(a_Value) INT32_C(a_Value)
|
---|
2619 | # define RTCCINTREG_MAX INT32_MAX
|
---|
2620 | # define RTCCINTREG_MIN INT32_MIN
|
---|
2621 | # define RTCCINTREG_FMT "RI32"
|
---|
2622 | # define RTCCINTREG_XFMT "RX32"
|
---|
2623 | #elif ARCH_BITS == 64
|
---|
2624 | # define RTCCUINTREG_C(a_Value) UINT64_C(a_Value)
|
---|
2625 | # define RTCCUINTREG_MAX UINT64_MAX
|
---|
2626 | # define RTCCUINTREG_FMT "RU64"
|
---|
2627 | # define RTCCUINTREG_XFMT "RX64"
|
---|
2628 | # define RTCCINTREG_C(a_Value) INT64_C(a_Value)
|
---|
2629 | # define RTCCINTREG_MAX INT64_MAX
|
---|
2630 | # define RTCCINTREG_MIN INT64_MIN
|
---|
2631 | # define RTCCINTREG_FMT "RI64"
|
---|
2632 | # define RTCCINTREG_XFMT "RX64"
|
---|
2633 | #elif ARCH_BITS == 16
|
---|
2634 | # define RTCCUINTREG_C(a_Value) UINT16_C(a_Value)
|
---|
2635 | # define RTCCUINTREG_MAX UINT16_MAX
|
---|
2636 | # define RTCCUINTREG_FMT "RU16"
|
---|
2637 | # define RTCCUINTREG_XFMT "RX16"
|
---|
2638 | # define RTCCINTREG_C(a_Value) INT16_C(a_Value)
|
---|
2639 | # define RTCCINTREG_MAX INT16_MAX
|
---|
2640 | # define RTCCINTREG_MIN INT16_MIN
|
---|
2641 | # define RTCCINTREG_FMT "RI16"
|
---|
2642 | # define RTCCINTREG_XFMT "RX16"
|
---|
2643 | #else
|
---|
2644 | # error "Unsupported ARCH_BITS!"
|
---|
2645 | #endif
|
---|
2646 | /** @def RTCCUINTXREG_C
|
---|
2647 | * Defines a constant of RTCCUINTXREG type.
|
---|
2648 | * @param a_Value Constant value */
|
---|
2649 | /** @def RTCCUINTXREG_MAX
|
---|
2650 | * Max value that RTCCUINTXREG can hold. */
|
---|
2651 | /** @def RTCCUINTXREG_FMT
|
---|
2652 | * Generic IPRT format specifier for RTCCUINTXREG. */
|
---|
2653 | /** @def RTCCUINTXREG_XFMT
|
---|
2654 | * Generic IPRT format specifier for RTCCUINTXREG, hexadecimal. */
|
---|
2655 | /** @def RTCCINTXREG_C
|
---|
2656 | * Defines a constant of RTCCINTXREG type.
|
---|
2657 | * @param a_Value Constant value */
|
---|
2658 | /** @def RTCCINTXREG_MAX
|
---|
2659 | * Max value that RTCCINTXREG can hold. */
|
---|
2660 | /** @def RTCCINTXREG_MIN
|
---|
2661 | * Min value that RTCCINTXREG can hold. */
|
---|
2662 | /** @def RTCCINTXREG_FMT
|
---|
2663 | * Generic IPRT format specifier for RTCCINTXREG. */
|
---|
2664 | /** @def RTCCINTXREG_XFMT
|
---|
2665 | * Generic IPRT format specifier for RTCCINTXREG, hexadecimal. */
|
---|
2666 | /** @def RTCCINTXREG_BITS
|
---|
2667 | * The width of RTCCINTXREG in bits (32 or 64). */
|
---|
2668 | #if ARCH_BITS == 16 && defined(RT_ARCH_X86)
|
---|
2669 | # define RTCCUINTXREG_C(a_Value) UINT32_C(a_Value)
|
---|
2670 | # define RTCCUINTXREG_MAX UINT32_MAX
|
---|
2671 | # define RTCCUINTXREG_FMT "RU32"
|
---|
2672 | # define RTCCUINTXREG_XFMT "RX32"
|
---|
2673 | # define RTCCINTXREG_C(a_Value) INT32_C(a_Value)
|
---|
2674 | # define RTCCINTXREG_MAX INT32_MAX
|
---|
2675 | # define RTCCINTXREG_MIN INT32_MIN
|
---|
2676 | # define RTCCINTXREG_FMT "RI32"
|
---|
2677 | # define RTCCINTXREG_XFMT "RX32"
|
---|
2678 | # define RTCCINTXREG_BITS 32
|
---|
2679 | #else
|
---|
2680 | # define RTCCUINTXREG_C(a_Value) RTCCUINTREG_C(a_Value)
|
---|
2681 | # define RTCCUINTXREG_MAX RTCCUINTREG_MAX
|
---|
2682 | # define RTCCUINTXREG_FMT RTCCUINTREG_FMT
|
---|
2683 | # define RTCCUINTXREG_XFMT RTCCUINTREG_XFMT
|
---|
2684 | # define RTCCINTXREG_C(a_Value) RTCCINTREG_C(a_Value)
|
---|
2685 | # define RTCCINTXREG_MAX RTCCINTREG_MAX
|
---|
2686 | # define RTCCINTXREG_MIN RTCCINTREG_MIN
|
---|
2687 | # define RTCCINTXREG_FMT RTCCINTREG_FMT
|
---|
2688 | # define RTCCINTXREG_XFMT RTCCINTREG_XFMT
|
---|
2689 | # define RTCCINTXREG_BITS ARCH_BITS
|
---|
2690 | #endif
|
---|
2691 | /** @} */
|
---|
2692 |
|
---|
2693 |
|
---|
2694 |
|
---|
2695 | /** Pointer to a big integer number. */
|
---|
2696 | typedef struct RTBIGNUM RT_FAR *PRTBIGNUM;
|
---|
2697 | /** Pointer to a const big integer number. */
|
---|
2698 | typedef struct RTBIGNUM const RT_FAR *PCRTBIGNUM;
|
---|
2699 |
|
---|
2700 |
|
---|
2701 | /** Pointer to a critical section. */
|
---|
2702 | typedef struct RTCRITSECT RT_FAR *PRTCRITSECT;
|
---|
2703 | /** Pointer to a const critical section. */
|
---|
2704 | typedef const struct RTCRITSECT RT_FAR *PCRTCRITSECT;
|
---|
2705 |
|
---|
2706 | /** Pointer to a read/write critical section. */
|
---|
2707 | typedef struct RTCRITSECTRW RT_FAR *PRTCRITSECTRW;
|
---|
2708 | /** Pointer to a const read/write critical section. */
|
---|
2709 | typedef const struct RTCRITSECTRW RT_FAR *PCRTCRITSECTRW;
|
---|
2710 |
|
---|
2711 |
|
---|
2712 | /** Condition variable handle. */
|
---|
2713 | typedef R3PTRTYPE(struct RTCONDVARINTERNAL RT_FAR *) RTCONDVAR;
|
---|
2714 | /** Pointer to a condition variable handle. */
|
---|
2715 | typedef RTCONDVAR RT_FAR *PRTCONDVAR;
|
---|
2716 | /** Nil condition variable handle. */
|
---|
2717 | #define NIL_RTCONDVAR 0
|
---|
2718 |
|
---|
2719 | /** Cryptographic (certificate) store handle. */
|
---|
2720 | typedef R3R0PTRTYPE(struct RTCRSTOREINT RT_FAR *) RTCRSTORE;
|
---|
2721 | /** Pointer to a Cryptographic (certificate) store handle. */
|
---|
2722 | typedef RTCRSTORE RT_FAR *PRTCRSTORE;
|
---|
2723 | /** Nil Cryptographic (certificate) store handle. */
|
---|
2724 | #define NIL_RTCRSTORE 0
|
---|
2725 |
|
---|
2726 | /** Pointer to a const (store) certificate context. */
|
---|
2727 | typedef struct RTCRCERTCTX const RT_FAR *PCRTCRCERTCTX;
|
---|
2728 |
|
---|
2729 | /** Cryptographic message digest handle. */
|
---|
2730 | typedef R3R0PTRTYPE(struct RTCRDIGESTINT RT_FAR *) RTCRDIGEST;
|
---|
2731 | /** Pointer to a cryptographic message digest handle. */
|
---|
2732 | typedef RTCRDIGEST RT_FAR *PRTCRDIGEST;
|
---|
2733 | /** NIL cryptographic message digest handle. */
|
---|
2734 | #define NIL_RTCRDIGEST (0)
|
---|
2735 |
|
---|
2736 | /** Cryptographic key handle. */
|
---|
2737 | typedef R3R0PTRTYPE(struct RTCRKEYINT RT_FAR *) RTCRKEY;
|
---|
2738 | /** Pointer to a cryptographic key handle. */
|
---|
2739 | typedef RTCRKEY RT_FAR *PRTCRKEY;
|
---|
2740 | /** Cryptographic key handle nil value. */
|
---|
2741 | #define NIL_RTCRKEY (0)
|
---|
2742 |
|
---|
2743 | /** Public key encryption schema handle. */
|
---|
2744 | typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT RT_FAR *) RTCRPKIXENCRYPTION;
|
---|
2745 | /** Pointer to a public key encryption schema handle. */
|
---|
2746 | typedef RTCRPKIXENCRYPTION RT_FAR *PRTCRPKIXENCRYPTION;
|
---|
2747 | /** NIL public key encryption schema handle */
|
---|
2748 | #define NIL_RTCRPKIXENCRYPTION (0)
|
---|
2749 |
|
---|
2750 | /** Public key signature schema handle. */
|
---|
2751 | typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT RT_FAR *) RTCRPKIXSIGNATURE;
|
---|
2752 | /** Pointer to a public key signature schema handle. */
|
---|
2753 | typedef RTCRPKIXSIGNATURE RT_FAR *PRTCRPKIXSIGNATURE;
|
---|
2754 | /** NIL public key signature schema handle */
|
---|
2755 | #define NIL_RTCRPKIXSIGNATURE (0)
|
---|
2756 |
|
---|
2757 | /** X.509 certificate paths builder & validator handle. */
|
---|
2758 | typedef R3R0PTRTYPE(struct RTCRX509CERTPATHSINT RT_FAR *) RTCRX509CERTPATHS;
|
---|
2759 | /** Pointer to a certificate paths builder & validator handle. */
|
---|
2760 | typedef RTCRX509CERTPATHS RT_FAR *PRTCRX509CERTPATHS;
|
---|
2761 | /** Nil certificate paths builder & validator handle. */
|
---|
2762 | #define NIL_RTCRX509CERTPATHS 0
|
---|
2763 |
|
---|
2764 | /** Directory handle. */
|
---|
2765 | typedef struct RTDIRINTERNAL *RTDIR;
|
---|
2766 | /** Pointer to directory handle. */
|
---|
2767 | typedef RTDIR *PRTDIR;
|
---|
2768 | /** NIL directory handle. */
|
---|
2769 | #define NIL_RTDIR ((RTDIR)0)
|
---|
2770 |
|
---|
2771 | /** File handle. */
|
---|
2772 | typedef R3R0PTRTYPE(struct RTFILEINT RT_FAR *) RTFILE;
|
---|
2773 | /** Pointer to file handle. */
|
---|
2774 | typedef RTFILE RT_FAR *PRTFILE;
|
---|
2775 | /** Nil file handle. */
|
---|
2776 | #define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
|
---|
2777 |
|
---|
2778 | /** Async I/O request handle. */
|
---|
2779 | typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL RT_FAR *) RTFILEAIOREQ;
|
---|
2780 | /** Pointer to an async I/O request handle. */
|
---|
2781 | typedef RTFILEAIOREQ RT_FAR *PRTFILEAIOREQ;
|
---|
2782 | /** Nil request handle. */
|
---|
2783 | #define NIL_RTFILEAIOREQ 0
|
---|
2784 |
|
---|
2785 | /** Async I/O completion context handle. */
|
---|
2786 | typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL RT_FAR *) RTFILEAIOCTX;
|
---|
2787 | /** Pointer to an async I/O completion context handle. */
|
---|
2788 | typedef RTFILEAIOCTX RT_FAR *PRTFILEAIOCTX;
|
---|
2789 | /** Nil context handle. */
|
---|
2790 | #define NIL_RTFILEAIOCTX 0
|
---|
2791 |
|
---|
2792 | /** ISO image maker handle. */
|
---|
2793 | typedef struct RTFSISOMAKERINT RT_FAR *RTFSISOMAKER;
|
---|
2794 | /** Pointer to an ISO image maker handle. */
|
---|
2795 | typedef RTFSISOMAKER RT_FAR *PRTFSISOMAKER;
|
---|
2796 | /** NIL ISO maker handle. */
|
---|
2797 | #define NIL_RTFSISOMAKER ((RTFSISOMAKER)0)
|
---|
2798 |
|
---|
2799 | /** INI-file handle. */
|
---|
2800 | typedef struct RTINIFILEINT RT_FAR *RTINIFILE;
|
---|
2801 | /** Pointer to an INI-file handle. */
|
---|
2802 | typedef RTINIFILE RT_FAR *PRTINIFILE;
|
---|
2803 | /** NIL INI-file handle. */
|
---|
2804 | #define NIL_RTINIFILE ((RTINIFILE)0)
|
---|
2805 |
|
---|
2806 | /** Loader module handle. */
|
---|
2807 | typedef R3R0PTRTYPE(struct RTLDRMODINTERNAL RT_FAR *) RTLDRMOD;
|
---|
2808 | /** Pointer to a loader module handle. */
|
---|
2809 | typedef RTLDRMOD RT_FAR *PRTLDRMOD;
|
---|
2810 | /** Nil loader module handle. */
|
---|
2811 | #define NIL_RTLDRMOD 0
|
---|
2812 |
|
---|
2813 | /** Lock validator class handle. */
|
---|
2814 | typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT RT_FAR *) RTLOCKVALCLASS;
|
---|
2815 | /** Pointer to a lock validator class handle. */
|
---|
2816 | typedef RTLOCKVALCLASS RT_FAR *PRTLOCKVALCLASS;
|
---|
2817 | /** Nil lock validator class handle. */
|
---|
2818 | #define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
|
---|
2819 |
|
---|
2820 | /** Ring-0 memory object handle. */
|
---|
2821 | typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL RT_FAR *) RTR0MEMOBJ;
|
---|
2822 | /** Pointer to a Ring-0 memory object handle. */
|
---|
2823 | typedef RTR0MEMOBJ RT_FAR *PRTR0MEMOBJ;
|
---|
2824 | /** Nil ring-0 memory object handle. */
|
---|
2825 | #define NIL_RTR0MEMOBJ 0
|
---|
2826 |
|
---|
2827 | /** Native thread handle. */
|
---|
2828 | typedef RTHCUINTPTR RTNATIVETHREAD;
|
---|
2829 | /** Pointer to an native thread handle. */
|
---|
2830 | typedef RTNATIVETHREAD RT_FAR *PRTNATIVETHREAD;
|
---|
2831 | /** Nil native thread handle. */
|
---|
2832 | #define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
|
---|
2833 |
|
---|
2834 | /** Pipe handle. */
|
---|
2835 | typedef R3R0PTRTYPE(struct RTPIPEINTERNAL RT_FAR *) RTPIPE;
|
---|
2836 | /** Pointer to a pipe handle. */
|
---|
2837 | typedef RTPIPE RT_FAR *PRTPIPE;
|
---|
2838 | /** Nil pipe handle.
|
---|
2839 | * @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
|
---|
2840 | #define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
|
---|
2841 |
|
---|
2842 | /** @typedef RTPOLLSET
|
---|
2843 | * Poll set handle. */
|
---|
2844 | typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL RT_FAR *) RTPOLLSET;
|
---|
2845 | /** Pointer to a poll set handle. */
|
---|
2846 | typedef RTPOLLSET RT_FAR *PRTPOLLSET;
|
---|
2847 | /** Nil poll set handle handle. */
|
---|
2848 | #define NIL_RTPOLLSET ((RTPOLLSET)0)
|
---|
2849 |
|
---|
2850 | /** Process identifier. */
|
---|
2851 | typedef uint32_t RTPROCESS;
|
---|
2852 | /** Pointer to a process identifier. */
|
---|
2853 | typedef RTPROCESS RT_FAR *PRTPROCESS;
|
---|
2854 | /** Nil process identifier. */
|
---|
2855 | #define NIL_RTPROCESS (~(RTPROCESS)0)
|
---|
2856 |
|
---|
2857 | /** Process ring-0 handle. */
|
---|
2858 | typedef RTR0UINTPTR RTR0PROCESS;
|
---|
2859 | /** Pointer to a ring-0 process handle. */
|
---|
2860 | typedef RTR0PROCESS RT_FAR *PRTR0PROCESS;
|
---|
2861 | /** Nil ring-0 process handle. */
|
---|
2862 | #define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
|
---|
2863 |
|
---|
2864 | /** @typedef RTSEMEVENT
|
---|
2865 | * Event Semaphore handle. */
|
---|
2866 | typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL RT_FAR *) RTSEMEVENT;
|
---|
2867 | /** Pointer to an event semaphore handle. */
|
---|
2868 | typedef RTSEMEVENT RT_FAR *PRTSEMEVENT;
|
---|
2869 | /** Nil event semaphore handle. */
|
---|
2870 | #define NIL_RTSEMEVENT 0
|
---|
2871 |
|
---|
2872 | /** @typedef RTSEMEVENTMULTI
|
---|
2873 | * Event Multiple Release Semaphore handle. */
|
---|
2874 | typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL RT_FAR *) RTSEMEVENTMULTI;
|
---|
2875 | /** Pointer to an event multiple release semaphore handle. */
|
---|
2876 | typedef RTSEMEVENTMULTI RT_FAR *PRTSEMEVENTMULTI;
|
---|
2877 | /** Nil multiple release event semaphore handle. */
|
---|
2878 | #define NIL_RTSEMEVENTMULTI 0
|
---|
2879 |
|
---|
2880 | /** @typedef RTSEMFASTMUTEX
|
---|
2881 | * Fast mutex Semaphore handle. */
|
---|
2882 | typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL RT_FAR *) RTSEMFASTMUTEX;
|
---|
2883 | /** Pointer to a fast mutex semaphore handle. */
|
---|
2884 | typedef RTSEMFASTMUTEX RT_FAR *PRTSEMFASTMUTEX;
|
---|
2885 | /** Nil fast mutex semaphore handle. */
|
---|
2886 | #define NIL_RTSEMFASTMUTEX 0
|
---|
2887 |
|
---|
2888 | /** @typedef RTSEMMUTEX
|
---|
2889 | * Mutex Semaphore handle. */
|
---|
2890 | typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL RT_FAR *) RTSEMMUTEX;
|
---|
2891 | /** Pointer to a mutex semaphore handle. */
|
---|
2892 | typedef RTSEMMUTEX RT_FAR *PRTSEMMUTEX;
|
---|
2893 | /** Nil mutex semaphore handle. */
|
---|
2894 | #define NIL_RTSEMMUTEX 0
|
---|
2895 |
|
---|
2896 | /** @typedef RTSEMSPINMUTEX
|
---|
2897 | * Spinning mutex Semaphore handle. */
|
---|
2898 | typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL RT_FAR *) RTSEMSPINMUTEX;
|
---|
2899 | /** Pointer to a spinning mutex semaphore handle. */
|
---|
2900 | typedef RTSEMSPINMUTEX RT_FAR *PRTSEMSPINMUTEX;
|
---|
2901 | /** Nil spinning mutex semaphore handle. */
|
---|
2902 | #define NIL_RTSEMSPINMUTEX 0
|
---|
2903 |
|
---|
2904 | /** @typedef RTSEMRW
|
---|
2905 | * Read/Write Semaphore handle. */
|
---|
2906 | typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL RT_FAR *) RTSEMRW;
|
---|
2907 | /** Pointer to a read/write semaphore handle. */
|
---|
2908 | typedef RTSEMRW RT_FAR *PRTSEMRW;
|
---|
2909 | /** Nil read/write semaphore handle. */
|
---|
2910 | #define NIL_RTSEMRW 0
|
---|
2911 |
|
---|
2912 | /** @typedef RTSEMXROADS
|
---|
2913 | * Crossroads semaphore handle. */
|
---|
2914 | typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL RT_FAR *) RTSEMXROADS;
|
---|
2915 | /** Pointer to a crossroads semaphore handle. */
|
---|
2916 | typedef RTSEMXROADS RT_FAR *PRTSEMXROADS;
|
---|
2917 | /** Nil crossroads semaphore handle. */
|
---|
2918 | #define NIL_RTSEMXROADS ((RTSEMXROADS)0)
|
---|
2919 |
|
---|
2920 | /** Spinlock handle. */
|
---|
2921 | typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL RT_FAR *) RTSPINLOCK;
|
---|
2922 | /** Pointer to a spinlock handle. */
|
---|
2923 | typedef RTSPINLOCK RT_FAR *PRTSPINLOCK;
|
---|
2924 | /** Nil spinlock handle. */
|
---|
2925 | #define NIL_RTSPINLOCK 0
|
---|
2926 |
|
---|
2927 | /** Socket handle. */
|
---|
2928 | typedef R3R0PTRTYPE(struct RTSOCKETINT RT_FAR *) RTSOCKET;
|
---|
2929 | /** Pointer to socket handle. */
|
---|
2930 | typedef RTSOCKET RT_FAR *PRTSOCKET;
|
---|
2931 | /** Nil socket handle. */
|
---|
2932 | #define NIL_RTSOCKET ((RTSOCKET)0)
|
---|
2933 |
|
---|
2934 | /** Pointer to a RTTCPSERVER handle. */
|
---|
2935 | typedef struct RTTCPSERVER RT_FAR *PRTTCPSERVER;
|
---|
2936 | /** Pointer to a RTTCPSERVER handle. */
|
---|
2937 | typedef PRTTCPSERVER RT_FAR *PPRTTCPSERVER;
|
---|
2938 | /** Nil RTTCPSERVER handle. */
|
---|
2939 | #define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
|
---|
2940 |
|
---|
2941 | /** Pointer to a RTUDPSERVER handle. */
|
---|
2942 | typedef struct RTUDPSERVER RT_FAR *PRTUDPSERVER;
|
---|
2943 | /** Pointer to a RTUDPSERVER handle. */
|
---|
2944 | typedef PRTUDPSERVER RT_FAR *PPRTUDPSERVER;
|
---|
2945 | /** Nil RTUDPSERVER handle. */
|
---|
2946 | #define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
|
---|
2947 |
|
---|
2948 | /** Thread handle.*/
|
---|
2949 | typedef R3R0PTRTYPE(struct RTTHREADINT RT_FAR *) RTTHREAD;
|
---|
2950 | /** Pointer to thread handle. */
|
---|
2951 | typedef RTTHREAD RT_FAR *PRTTHREAD;
|
---|
2952 | /** Nil thread handle. */
|
---|
2953 | #define NIL_RTTHREAD 0
|
---|
2954 |
|
---|
2955 | /** Thread context switching hook handle. */
|
---|
2956 | typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT RT_FAR *) RTTHREADCTXHOOK;
|
---|
2957 | /** Pointer to Thread context switching hook handle. */
|
---|
2958 | typedef RTTHREADCTXHOOK RT_FAR *PRTTHREADCTXHOOK;
|
---|
2959 | /** Nil Thread context switching hook handle. */
|
---|
2960 | #define NIL_RTTHREADCTXHOOK ((RTTHREADCTXHOOK)0)
|
---|
2961 |
|
---|
2962 | /** A TLS index. */
|
---|
2963 | typedef RTHCINTPTR RTTLS;
|
---|
2964 | /** Pointer to a TLS index. */
|
---|
2965 | typedef RTTLS RT_FAR *PRTTLS;
|
---|
2966 | /** Pointer to a const TLS index. */
|
---|
2967 | typedef RTTLS const RT_FAR *PCRTTLS;
|
---|
2968 | /** NIL TLS index value. */
|
---|
2969 | #define NIL_RTTLS ((RTTLS)-1)
|
---|
2970 |
|
---|
2971 | /** Trace buffer handle.
|
---|
2972 | * @remarks This is not a R3/R0 type like most other handles!
|
---|
2973 | */
|
---|
2974 | typedef struct RTTRACEBUFINT RT_FAR *RTTRACEBUF;
|
---|
2975 | /** Pointer to a trace buffer handle. */
|
---|
2976 | typedef RTTRACEBUF RT_FAR *PRTTRACEBUF;
|
---|
2977 | /** Nil trace buffer handle. */
|
---|
2978 | #define NIL_RTTRACEBUF ((RTTRACEBUF)0)
|
---|
2979 | /** The handle of the default trace buffer.
|
---|
2980 | * This can be used with any of the RTTraceBufAdd APIs. */
|
---|
2981 | #define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
|
---|
2982 |
|
---|
2983 | /** Handle to a simple heap. */
|
---|
2984 | typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL RT_FAR *) RTHEAPSIMPLE;
|
---|
2985 | /** Pointer to a handle to a simple heap. */
|
---|
2986 | typedef RTHEAPSIMPLE RT_FAR *PRTHEAPSIMPLE;
|
---|
2987 | /** NIL simple heap handle. */
|
---|
2988 | #define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
|
---|
2989 |
|
---|
2990 | /** Handle to an offset based heap. */
|
---|
2991 | typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL RT_FAR *) RTHEAPOFFSET;
|
---|
2992 | /** Pointer to a handle to an offset based heap. */
|
---|
2993 | typedef RTHEAPOFFSET RT_FAR *PRTHEAPOFFSET;
|
---|
2994 | /** NIL offset based heap handle. */
|
---|
2995 | #define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
|
---|
2996 |
|
---|
2997 | /** Handle to an environment block. */
|
---|
2998 | typedef R3PTRTYPE(struct RTENVINTERNAL RT_FAR *) RTENV;
|
---|
2999 | /** Pointer to a handle to an environment block. */
|
---|
3000 | typedef RTENV RT_FAR *PRTENV;
|
---|
3001 | /** NIL simple heap handle. */
|
---|
3002 | #define NIL_RTENV ((RTENV)0)
|
---|
3003 |
|
---|
3004 | /** A CPU identifier.
|
---|
3005 | * @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
|
---|
3006 | * does it have to correspond to the bits in the affinity mask, at
|
---|
3007 | * least not until we've sorted out Windows NT. */
|
---|
3008 | typedef uint32_t RTCPUID;
|
---|
3009 | /** Pointer to a CPU identifier. */
|
---|
3010 | typedef RTCPUID RT_FAR *PRTCPUID;
|
---|
3011 | /** Pointer to a const CPU identifier. */
|
---|
3012 | typedef RTCPUID const RT_FAR *PCRTCPUID;
|
---|
3013 | /** Nil CPU Id. */
|
---|
3014 | #define NIL_RTCPUID ((RTCPUID)~0)
|
---|
3015 |
|
---|
3016 | /** The maximum number of CPUs a set can contain and IPRT is able
|
---|
3017 | * to reference. (Should be max of support arch/platforms.)
|
---|
3018 | * @remarks Must be a power of two and multiple of 64 (see RTCPUSET). */
|
---|
3019 | #if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
|
---|
3020 | # if defined(RT_OS_OS2)
|
---|
3021 | # define RTCPUSET_MAX_CPUS 64
|
---|
3022 | # elif defined(RT_OS_DARWIN) || defined(RT_ARCH_X86)
|
---|
3023 | # define RTCPUSET_MAX_CPUS 256
|
---|
3024 | # else
|
---|
3025 | # define RTCPUSET_MAX_CPUS 1024
|
---|
3026 | # endif
|
---|
3027 | #elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
|
---|
3028 | # define RTCPUSET_MAX_CPUS 1024
|
---|
3029 | #else
|
---|
3030 | # define RTCPUSET_MAX_CPUS 64
|
---|
3031 | #endif
|
---|
3032 | /** A CPU set.
|
---|
3033 | * @note Treat this as an opaque type and always use RTCpuSet* for
|
---|
3034 | * manipulating it. */
|
---|
3035 | typedef struct RTCPUSET
|
---|
3036 | {
|
---|
3037 | /** The bitmap. */
|
---|
3038 | uint64_t bmSet[RTCPUSET_MAX_CPUS / 64];
|
---|
3039 | } RTCPUSET;
|
---|
3040 | /** Pointer to a CPU set. */
|
---|
3041 | typedef RTCPUSET RT_FAR *PRTCPUSET;
|
---|
3042 | /** Pointer to a const CPU set. */
|
---|
3043 | typedef RTCPUSET const RT_FAR *PCRTCPUSET;
|
---|
3044 |
|
---|
3045 | /** A handle table handle. */
|
---|
3046 | typedef R3R0PTRTYPE(struct RTHANDLETABLEINT RT_FAR *) RTHANDLETABLE;
|
---|
3047 | /** A pointer to a handle table handle. */
|
---|
3048 | typedef RTHANDLETABLE RT_FAR *PRTHANDLETABLE;
|
---|
3049 | /** @def NIL_RTHANDLETABLE
|
---|
3050 | * NIL handle table handle. */
|
---|
3051 | #define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
|
---|
3052 |
|
---|
3053 | /** A handle to a low resolution timer. */
|
---|
3054 | typedef R3R0PTRTYPE(struct RTTIMERLRINT RT_FAR *) RTTIMERLR;
|
---|
3055 | /** A pointer to a low resolution timer handle. */
|
---|
3056 | typedef RTTIMERLR RT_FAR *PRTTIMERLR;
|
---|
3057 | /** @def NIL_RTTIMERLR
|
---|
3058 | * NIL low resolution timer handle value. */
|
---|
3059 | #define NIL_RTTIMERLR ((RTTIMERLR)0)
|
---|
3060 |
|
---|
3061 | /** Handle to a random number generator. */
|
---|
3062 | typedef R3R0PTRTYPE(struct RTRANDINT RT_FAR *) RTRAND;
|
---|
3063 | /** Pointer to a random number generator handle. */
|
---|
3064 | typedef RTRAND RT_FAR *PRTRAND;
|
---|
3065 | /** NIL random number generator handle value. */
|
---|
3066 | #define NIL_RTRAND ((RTRAND)0)
|
---|
3067 |
|
---|
3068 | /** Debug address space handle. */
|
---|
3069 | typedef R3R0PTRTYPE(struct RTDBGASINT RT_FAR *) RTDBGAS;
|
---|
3070 | /** Pointer to a debug address space handle. */
|
---|
3071 | typedef RTDBGAS RT_FAR *PRTDBGAS;
|
---|
3072 | /** NIL debug address space handle. */
|
---|
3073 | #define NIL_RTDBGAS ((RTDBGAS)0)
|
---|
3074 |
|
---|
3075 | /** Debug module handle. */
|
---|
3076 | typedef R3R0PTRTYPE(struct RTDBGMODINT RT_FAR *) RTDBGMOD;
|
---|
3077 | /** Pointer to a debug module handle. */
|
---|
3078 | typedef RTDBGMOD RT_FAR *PRTDBGMOD;
|
---|
3079 | /** NIL debug module handle. */
|
---|
3080 | #define NIL_RTDBGMOD ((RTDBGMOD)0)
|
---|
3081 |
|
---|
3082 | /** Pointer to an unwind machine state. */
|
---|
3083 | typedef struct RTDBGUNWINDSTATE RT_FAR *PRTDBGUNWINDSTATE;
|
---|
3084 | /** Pointer to a const unwind machine state. */
|
---|
3085 | typedef struct RTDBGUNWINDSTATE const RT_FAR *PCRTDBGUNWINDSTATE;
|
---|
3086 |
|
---|
3087 | /** Manifest handle. */
|
---|
3088 | typedef struct RTMANIFESTINT RT_FAR *RTMANIFEST;
|
---|
3089 | /** Pointer to a manifest handle. */
|
---|
3090 | typedef RTMANIFEST RT_FAR *PRTMANIFEST;
|
---|
3091 | /** NIL manifest handle. */
|
---|
3092 | #define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
|
---|
3093 |
|
---|
3094 | /** Memory pool handle. */
|
---|
3095 | typedef R3R0PTRTYPE(struct RTMEMPOOLINT RT_FAR *) RTMEMPOOL;
|
---|
3096 | /** Pointer to a memory pool handle. */
|
---|
3097 | typedef RTMEMPOOL RT_FAR *PRTMEMPOOL;
|
---|
3098 | /** NIL memory pool handle. */
|
---|
3099 | #define NIL_RTMEMPOOL ((RTMEMPOOL)0)
|
---|
3100 | /** The default memory pool handle. */
|
---|
3101 | #define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
|
---|
3102 |
|
---|
3103 | /** String cache handle. */
|
---|
3104 | typedef R3R0PTRTYPE(struct RTSTRCACHEINT RT_FAR *) RTSTRCACHE;
|
---|
3105 | /** Pointer to a string cache handle. */
|
---|
3106 | typedef RTSTRCACHE RT_FAR *PRTSTRCACHE;
|
---|
3107 | /** NIL string cache handle. */
|
---|
3108 | #define NIL_RTSTRCACHE ((RTSTRCACHE)0)
|
---|
3109 | /** The default string cache handle. */
|
---|
3110 | #define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
|
---|
3111 |
|
---|
3112 |
|
---|
3113 | /** Virtual Filesystem handle. */
|
---|
3114 | typedef struct RTVFSINTERNAL RT_FAR *RTVFS;
|
---|
3115 | /** Pointer to a VFS handle. */
|
---|
3116 | typedef RTVFS RT_FAR *PRTVFS;
|
---|
3117 | /** A NIL VFS handle. */
|
---|
3118 | #define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
|
---|
3119 |
|
---|
3120 | /** Virtual Filesystem base object handle. */
|
---|
3121 | typedef struct RTVFSOBJINTERNAL RT_FAR *RTVFSOBJ;
|
---|
3122 | /** Pointer to a VFS base object handle. */
|
---|
3123 | typedef RTVFSOBJ RT_FAR *PRTVFSOBJ;
|
---|
3124 | /** A NIL VFS base object handle. */
|
---|
3125 | #define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
|
---|
3126 |
|
---|
3127 | /** Virtual Filesystem directory handle. */
|
---|
3128 | typedef struct RTVFSDIRINTERNAL RT_FAR *RTVFSDIR;
|
---|
3129 | /** Pointer to a VFS directory handle. */
|
---|
3130 | typedef RTVFSDIR RT_FAR *PRTVFSDIR;
|
---|
3131 | /** A NIL VFS directory handle. */
|
---|
3132 | #define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
|
---|
3133 |
|
---|
3134 | /** Virtual Filesystem filesystem stream handle. */
|
---|
3135 | typedef struct RTVFSFSSTREAMINTERNAL RT_FAR *RTVFSFSSTREAM;
|
---|
3136 | /** Pointer to a VFS filesystem stream handle. */
|
---|
3137 | typedef RTVFSFSSTREAM RT_FAR *PRTVFSFSSTREAM;
|
---|
3138 | /** A NIL VFS filesystem stream handle. */
|
---|
3139 | #define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
|
---|
3140 |
|
---|
3141 | /** Virtual Filesystem I/O stream handle. */
|
---|
3142 | typedef struct RTVFSIOSTREAMINTERNAL RT_FAR *RTVFSIOSTREAM;
|
---|
3143 | /** Pointer to a VFS I/O stream handle. */
|
---|
3144 | typedef RTVFSIOSTREAM RT_FAR *PRTVFSIOSTREAM;
|
---|
3145 | /** A NIL VFS I/O stream handle. */
|
---|
3146 | #define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
|
---|
3147 |
|
---|
3148 | /** Virtual Filesystem file handle. */
|
---|
3149 | typedef struct RTVFSFILEINTERNAL RT_FAR *RTVFSFILE;
|
---|
3150 | /** Pointer to a VFS file handle. */
|
---|
3151 | typedef RTVFSFILE RT_FAR *PRTVFSFILE;
|
---|
3152 | /** A NIL VFS file handle. */
|
---|
3153 | #define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
|
---|
3154 |
|
---|
3155 | /** Virtual Filesystem symbolic link handle. */
|
---|
3156 | typedef struct RTVFSSYMLINKINTERNAL RT_FAR *RTVFSSYMLINK;
|
---|
3157 | /** Pointer to a VFS symbolic link handle. */
|
---|
3158 | typedef RTVFSSYMLINK RT_FAR *PRTVFSSYMLINK;
|
---|
3159 | /** A NIL VFS symbolic link handle. */
|
---|
3160 | #define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
|
---|
3161 |
|
---|
3162 | /** Async I/O manager handle. */
|
---|
3163 | typedef struct RTAIOMGRINT RT_FAR *RTAIOMGR;
|
---|
3164 | /** Pointer to a async I/O manager handle. */
|
---|
3165 | typedef RTAIOMGR RT_FAR *PRTAIOMGR;
|
---|
3166 | /** A NIL async I/O manager handle. */
|
---|
3167 | #define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
|
---|
3168 |
|
---|
3169 | /** Async I/O manager file handle. */
|
---|
3170 | typedef struct RTAIOMGRFILEINT RT_FAR *RTAIOMGRFILE;
|
---|
3171 | /** Pointer to a async I/O manager file handle. */
|
---|
3172 | typedef RTAIOMGRFILE RT_FAR *PRTAIOMGRFILE;
|
---|
3173 | /** A NIL async I/O manager file handle. */
|
---|
3174 | #define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
|
---|
3175 |
|
---|
3176 | /** Kernel module information record handle. */
|
---|
3177 | typedef struct RTKRNLMODINFOINT RT_FAR *RTKRNLMODINFO;
|
---|
3178 | /** Pointer to a kernel information record handle. */
|
---|
3179 | typedef RTKRNLMODINFO RT_FAR *PRTKRNLMODINFO;
|
---|
3180 | /** A NIL kernel module information record handle. */
|
---|
3181 | #define NIL_RTKRNLMODINFO ((RTKRNLMODINFO)~(uintptr_t)0);
|
---|
3182 |
|
---|
3183 | /** Shared memory object handle. */
|
---|
3184 | typedef struct RTSHMEMINT RT_FAR *RTSHMEM;
|
---|
3185 | /** Pointer to a shared memory object handle. */
|
---|
3186 | typedef RTSHMEM RT_FAR *PRTSHMEM;
|
---|
3187 | /** A NIL shared memory object handle. */
|
---|
3188 | #define NIL_RTSHMEM ((RTSHMEM)~(uintptr_t)0)
|
---|
3189 |
|
---|
3190 | /** EFI signature database handle. */
|
---|
3191 | typedef struct RTEFISIGDBINT RT_FAR *RTEFISIGDB;
|
---|
3192 | /** Pointer to a EFI signature database handle. */
|
---|
3193 | typedef RTEFISIGDB RT_FAR *PRTEFISIGDB;
|
---|
3194 | /** A NIL EFI signature database handle. */
|
---|
3195 | #define NIL_RTEFISIGDB ((RTEFISIGDB)~(uintptr_t)0)
|
---|
3196 |
|
---|
3197 |
|
---|
3198 | /**
|
---|
3199 | * Handle type.
|
---|
3200 | *
|
---|
3201 | * This is usually used together with RTHANDLEUNION.
|
---|
3202 | */
|
---|
3203 | typedef enum RTHANDLETYPE
|
---|
3204 | {
|
---|
3205 | /** The invalid zero value. */
|
---|
3206 | RTHANDLETYPE_INVALID = 0,
|
---|
3207 | /** File handle. */
|
---|
3208 | RTHANDLETYPE_FILE,
|
---|
3209 | /** Pipe handle */
|
---|
3210 | RTHANDLETYPE_PIPE,
|
---|
3211 | /** Socket handle. */
|
---|
3212 | RTHANDLETYPE_SOCKET,
|
---|
3213 | /** Thread handle. */
|
---|
3214 | RTHANDLETYPE_THREAD,
|
---|
3215 | /** The end of the valid values. */
|
---|
3216 | RTHANDLETYPE_END,
|
---|
3217 | /** The 32-bit type blow up. */
|
---|
3218 | RTHANDLETYPE_32BIT_HACK = 0x7fffffff
|
---|
3219 | } RTHANDLETYPE;
|
---|
3220 | /** Pointer to a handle type. */
|
---|
3221 | typedef RTHANDLETYPE RT_FAR *PRTHANDLETYPE;
|
---|
3222 |
|
---|
3223 | /**
|
---|
3224 | * Handle union.
|
---|
3225 | *
|
---|
3226 | * This is usually used together with RTHANDLETYPE or as RTHANDLE.
|
---|
3227 | */
|
---|
3228 | typedef union RTHANDLEUNION
|
---|
3229 | {
|
---|
3230 | RTFILE hFile; /**< File handle. */
|
---|
3231 | RTPIPE hPipe; /**< Pipe handle. */
|
---|
3232 | RTSOCKET hSocket; /**< Socket handle. */
|
---|
3233 | RTTHREAD hThread; /**< Thread handle. */
|
---|
3234 | /** Generic integer handle value.
|
---|
3235 | * Note that RTFILE is not yet pointer sized, so accessing it via this member
|
---|
3236 | * isn't necessarily safe or fully portable. */
|
---|
3237 | RTHCUINTPTR uInt;
|
---|
3238 | } RTHANDLEUNION;
|
---|
3239 | /** Pointer to a handle union. */
|
---|
3240 | typedef RTHANDLEUNION RT_FAR *PRTHANDLEUNION;
|
---|
3241 | /** Pointer to a const handle union. */
|
---|
3242 | typedef RTHANDLEUNION const RT_FAR *PCRTHANDLEUNION;
|
---|
3243 |
|
---|
3244 | /**
|
---|
3245 | * Generic handle.
|
---|
3246 | */
|
---|
3247 | typedef struct RTHANDLE
|
---|
3248 | {
|
---|
3249 | /** The handle type. */
|
---|
3250 | RTHANDLETYPE enmType;
|
---|
3251 | /** The handle value. */
|
---|
3252 | RTHANDLEUNION u;
|
---|
3253 | } RTHANDLE;
|
---|
3254 | /** Pointer to a generic handle. */
|
---|
3255 | typedef RTHANDLE RT_FAR *PRTHANDLE;
|
---|
3256 | /** Pointer to a const generic handle. */
|
---|
3257 | typedef RTHANDLE const RT_FAR *PCRTHANDLE;
|
---|
3258 |
|
---|
3259 |
|
---|
3260 | /**
|
---|
3261 | * Standard handles.
|
---|
3262 | *
|
---|
3263 | * @remarks These have the correct file descriptor values for unixy systems and
|
---|
3264 | * can be used directly in code specific to those platforms.
|
---|
3265 | */
|
---|
3266 | typedef enum RTHANDLESTD
|
---|
3267 | {
|
---|
3268 | /** Invalid standard handle. */
|
---|
3269 | RTHANDLESTD_INVALID = -1,
|
---|
3270 | /** The standard input handle. */
|
---|
3271 | RTHANDLESTD_INPUT = 0,
|
---|
3272 | /** The standard output handle. */
|
---|
3273 | RTHANDLESTD_OUTPUT,
|
---|
3274 | /** The standard error handle. */
|
---|
3275 | RTHANDLESTD_ERROR,
|
---|
3276 | /** The typical 32-bit type hack. */
|
---|
3277 | RTHANDLESTD_32BIT_HACK = 0x7fffffff
|
---|
3278 | } RTHANDLESTD;
|
---|
3279 |
|
---|
3280 |
|
---|
3281 | /**
|
---|
3282 | * Error info.
|
---|
3283 | *
|
---|
3284 | * See RTErrInfo*.
|
---|
3285 | */
|
---|
3286 | typedef struct RTERRINFO
|
---|
3287 | {
|
---|
3288 | /** Flags, see RTERRINFO_FLAGS_XXX. */
|
---|
3289 | uint32_t fFlags;
|
---|
3290 | /** The status code. */
|
---|
3291 | int32_t rc;
|
---|
3292 | /** The size of the message */
|
---|
3293 | size_t cbMsg;
|
---|
3294 | /** The error buffer. */
|
---|
3295 | char *pszMsg;
|
---|
3296 | /** Reserved for future use. */
|
---|
3297 | void *apvReserved[2];
|
---|
3298 | } RTERRINFO;
|
---|
3299 | /** Pointer to an error info structure. */
|
---|
3300 | typedef RTERRINFO RT_FAR *PRTERRINFO;
|
---|
3301 | /** Pointer to a const error info structure. */
|
---|
3302 | typedef RTERRINFO const RT_FAR *PCRTERRINFO;
|
---|
3303 |
|
---|
3304 | /**
|
---|
3305 | * Static error info structure, see RTErrInfoInitStatic.
|
---|
3306 | */
|
---|
3307 | typedef struct RTERRINFOSTATIC
|
---|
3308 | {
|
---|
3309 | /** The core error info. */
|
---|
3310 | RTERRINFO Core;
|
---|
3311 | /** The static message buffer. */
|
---|
3312 | char szMsg[3072];
|
---|
3313 | } RTERRINFOSTATIC;
|
---|
3314 | /** Pointer to a error info buffer. */
|
---|
3315 | typedef RTERRINFOSTATIC RT_FAR *PRTERRINFOSTATIC;
|
---|
3316 | /** Pointer to a const static error info buffer. */
|
---|
3317 | typedef RTERRINFOSTATIC const RT_FAR *PCRTERRINFOSTATIC;
|
---|
3318 |
|
---|
3319 |
|
---|
3320 | /**
|
---|
3321 | * UUID data type.
|
---|
3322 | *
|
---|
3323 | * See RTUuid*.
|
---|
3324 | *
|
---|
3325 | * @remarks IPRT defines that the first three integers in the @c Gen struct
|
---|
3326 | * interpretation are in little endian representation. This is
|
---|
3327 | * different to many other UUID implementation, and requires
|
---|
3328 | * conversion if you need to achieve consistent results.
|
---|
3329 | */
|
---|
3330 | typedef union RTUUID
|
---|
3331 | {
|
---|
3332 | /** 8-bit view. */
|
---|
3333 | uint8_t au8[16];
|
---|
3334 | /** 16-bit view. */
|
---|
3335 | uint16_t au16[8];
|
---|
3336 | /** 32-bit view. */
|
---|
3337 | uint32_t au32[4];
|
---|
3338 | /** 64-bit view. */
|
---|
3339 | uint64_t au64[2];
|
---|
3340 | /** The way the UUID is declared by the DCE specification. */
|
---|
3341 | struct
|
---|
3342 | {
|
---|
3343 | uint32_t u32TimeLow;
|
---|
3344 | uint16_t u16TimeMid;
|
---|
3345 | uint16_t u16TimeHiAndVersion;
|
---|
3346 | uint8_t u8ClockSeqHiAndReserved;
|
---|
3347 | uint8_t u8ClockSeqLow;
|
---|
3348 | uint8_t au8Node[6];
|
---|
3349 | } Gen;
|
---|
3350 | } RTUUID;
|
---|
3351 | /** Pointer to UUID data. */
|
---|
3352 | typedef RTUUID RT_FAR *PRTUUID;
|
---|
3353 | /** Pointer to readonly UUID data. */
|
---|
3354 | typedef const RTUUID RT_FAR *PCRTUUID;
|
---|
3355 |
|
---|
3356 | /** Initializes a RTUUID structure with all zeros (RTUuidIsNull() true). */
|
---|
3357 | #define RTUUID_INITIALIZE_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
|
---|
3358 |
|
---|
3359 | /** UUID string maximum length. */
|
---|
3360 | #define RTUUID_STR_LENGTH 37
|
---|
3361 |
|
---|
3362 |
|
---|
3363 | /** Compression handle. */
|
---|
3364 | typedef struct RTZIPCOMP RT_FAR *PRTZIPCOMP;
|
---|
3365 | /** Decompressor handle. */
|
---|
3366 | typedef struct RTZIPDECOMP RT_FAR *PRTZIPDECOMP;
|
---|
3367 |
|
---|
3368 |
|
---|
3369 | /**
|
---|
3370 | * Unicode Code Point.
|
---|
3371 | */
|
---|
3372 | typedef uint32_t RTUNICP;
|
---|
3373 | /** Pointer to an Unicode Code Point. */
|
---|
3374 | typedef RTUNICP RT_FAR *PRTUNICP;
|
---|
3375 | /** Pointer to an Unicode Code Point. */
|
---|
3376 | typedef const RTUNICP RT_FAR *PCRTUNICP;
|
---|
3377 | /** Max value a RTUNICP type can hold. */
|
---|
3378 | #define RTUNICP_MAX ( ~(RTUNICP)0 )
|
---|
3379 | /** Invalid code point.
|
---|
3380 | * This is returned when encountered invalid encodings or invalid
|
---|
3381 | * unicode code points. */
|
---|
3382 | #define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
|
---|
3383 |
|
---|
3384 |
|
---|
3385 | /**
|
---|
3386 | * UTF-16 character.
|
---|
3387 | * @remark wchar_t is not usable since it's compiler defined.
|
---|
3388 | * @remark When we use the term character we're not talking about unicode code point, but
|
---|
3389 | * the basic unit of the string encoding. Thus cwc - count of wide chars - means
|
---|
3390 | * count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
|
---|
3391 | * and cch means count of the typedef 'char', which is assumed to be an octet.
|
---|
3392 | */
|
---|
3393 | typedef uint16_t RTUTF16;
|
---|
3394 | /** Pointer to a UTF-16 character. */
|
---|
3395 | typedef RTUTF16 RT_FAR *PRTUTF16;
|
---|
3396 | /** Pointer to a const UTF-16 character. */
|
---|
3397 | typedef const RTUTF16 RT_FAR *PCRTUTF16;
|
---|
3398 |
|
---|
3399 |
|
---|
3400 | /**
|
---|
3401 | * String tuple to go with the RT_STR_TUPLE macro.
|
---|
3402 | */
|
---|
3403 | typedef struct RTSTRTUPLE
|
---|
3404 | {
|
---|
3405 | /** The string. */
|
---|
3406 | const char *psz;
|
---|
3407 | /** The string length. */
|
---|
3408 | size_t cch;
|
---|
3409 | } RTSTRTUPLE;
|
---|
3410 | /** Pointer to a string tuple. */
|
---|
3411 | typedef RTSTRTUPLE RT_FAR *PRTSTRTUPLE;
|
---|
3412 | /** Pointer to a const string tuple. */
|
---|
3413 | typedef RTSTRTUPLE const RT_FAR *PCRTSTRTUPLE;
|
---|
3414 |
|
---|
3415 | /**
|
---|
3416 | * Wait for ever if we have to.
|
---|
3417 | */
|
---|
3418 | #define RT_INDEFINITE_WAIT (~0U)
|
---|
3419 |
|
---|
3420 |
|
---|
3421 | /**
|
---|
3422 | * Generic process callback.
|
---|
3423 | *
|
---|
3424 | * @returns VBox status code. Failure will cancel the operation.
|
---|
3425 | * @param uPercentage The percentage of the operation which has been completed.
|
---|
3426 | * @param pvUser The user specified argument.
|
---|
3427 | */
|
---|
3428 | typedef DECLCALLBACKTYPE(int, FNRTPROGRESS,(unsigned uPercentage, void *pvUser));
|
---|
3429 | /** Pointer to a generic progress callback function, FNRTPROCESS(). */
|
---|
3430 | typedef FNRTPROGRESS *PFNRTPROGRESS;
|
---|
3431 |
|
---|
3432 | /**
|
---|
3433 | * Generic vprintf-like callback function for dumpers.
|
---|
3434 | *
|
---|
3435 | * @param pvUser User argument.
|
---|
3436 | * @param pszFormat The format string.
|
---|
3437 | * @param va Arguments for the format string.
|
---|
3438 | */
|
---|
3439 | typedef DECLCALLBACKTYPE(void, FNRTDUMPPRINTFV,(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0));
|
---|
3440 | /** Pointer to a generic printf-like function for dumping. */
|
---|
3441 | typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;
|
---|
3442 |
|
---|
3443 |
|
---|
3444 | /**
|
---|
3445 | * A point in a two dimentional coordinate system.
|
---|
3446 | */
|
---|
3447 | typedef struct RTPOINT
|
---|
3448 | {
|
---|
3449 | /** X coordinate. */
|
---|
3450 | int32_t x;
|
---|
3451 | /** Y coordinate. */
|
---|
3452 | int32_t y;
|
---|
3453 | } RTPOINT;
|
---|
3454 | /** Pointer to a point. */
|
---|
3455 | typedef RTPOINT RT_FAR *PRTPOINT;
|
---|
3456 | /** Pointer to a const point. */
|
---|
3457 | typedef const RTPOINT RT_FAR *PCRTPOINT;
|
---|
3458 |
|
---|
3459 |
|
---|
3460 | /**
|
---|
3461 | * Rectangle data type, double point.
|
---|
3462 | */
|
---|
3463 | typedef struct RTRECT
|
---|
3464 | {
|
---|
3465 | /** left X coordinate. */
|
---|
3466 | int32_t xLeft;
|
---|
3467 | /** top Y coordinate. */
|
---|
3468 | int32_t yTop;
|
---|
3469 | /** right X coordinate. (exclusive) */
|
---|
3470 | int32_t xRight;
|
---|
3471 | /** bottom Y coordinate. (exclusive) */
|
---|
3472 | int32_t yBottom;
|
---|
3473 | } RTRECT;
|
---|
3474 | /** Pointer to a double point rectangle. */
|
---|
3475 | typedef RTRECT RT_FAR *PRTRECT;
|
---|
3476 | /** Pointer to a const double point rectangle. */
|
---|
3477 | typedef const RTRECT RT_FAR *PCRTRECT;
|
---|
3478 |
|
---|
3479 |
|
---|
3480 | /**
|
---|
3481 | * Rectangle data type, point + size.
|
---|
3482 | */
|
---|
3483 | typedef struct RTRECT2
|
---|
3484 | {
|
---|
3485 | /** X coordinate.
|
---|
3486 | * Unless stated otherwise, this is the top left corner. */
|
---|
3487 | int32_t x;
|
---|
3488 | /** Y coordinate.
|
---|
3489 | * Unless stated otherwise, this is the top left corner. */
|
---|
3490 | int32_t y;
|
---|
3491 | /** The width.
|
---|
3492 | * Unless stated otherwise, this is to the right of (x,y) and will not
|
---|
3493 | * be a negative number. */
|
---|
3494 | int32_t cx;
|
---|
3495 | /** The height.
|
---|
3496 | * Unless stated otherwise, this is down from (x,y) and will not be a
|
---|
3497 | * negative number. */
|
---|
3498 | int32_t cy;
|
---|
3499 | } RTRECT2;
|
---|
3500 | /** Pointer to a point + size rectangle. */
|
---|
3501 | typedef RTRECT2 RT_FAR *PRTRECT2;
|
---|
3502 | /** Pointer to a const point + size rectangle. */
|
---|
3503 | typedef const RTRECT2 RT_FAR *PCRTRECT2;
|
---|
3504 |
|
---|
3505 |
|
---|
3506 | /**
|
---|
3507 | * The size of a rectangle.
|
---|
3508 | */
|
---|
3509 | typedef struct RTRECTSIZE
|
---|
3510 | {
|
---|
3511 | /** The width (along the x-axis). */
|
---|
3512 | uint32_t cx;
|
---|
3513 | /** The height (along the y-axis). */
|
---|
3514 | uint32_t cy;
|
---|
3515 | } RTRECTSIZE;
|
---|
3516 | /** Pointer to a rectangle size. */
|
---|
3517 | typedef RTRECTSIZE RT_FAR *PRTRECTSIZE;
|
---|
3518 | /** Pointer to a const rectangle size. */
|
---|
3519 | typedef const RTRECTSIZE RT_FAR *PCRTRECTSIZE;
|
---|
3520 |
|
---|
3521 |
|
---|
3522 | /**
|
---|
3523 | * Ethernet MAC address.
|
---|
3524 | *
|
---|
3525 | * The first 24 bits make up the Organisationally Unique Identifier (OUI),
|
---|
3526 | * where the first bit (little endian) indicates multicast (set) / unicast,
|
---|
3527 | * and the second bit indicates locally (set) / global administered. If all
|
---|
3528 | * bits are set, it's a broadcast.
|
---|
3529 | */
|
---|
3530 | typedef union RTMAC
|
---|
3531 | {
|
---|
3532 | /** @todo add a bitfield view of this stuff. */
|
---|
3533 | /** 8-bit view. */
|
---|
3534 | uint8_t au8[6];
|
---|
3535 | /** 16-bit view. */
|
---|
3536 | uint16_t au16[3];
|
---|
3537 | } RTMAC;
|
---|
3538 | /** Pointer to a MAC address. */
|
---|
3539 | typedef RTMAC RT_FAR *PRTMAC;
|
---|
3540 | /** Pointer to a readonly MAC address. */
|
---|
3541 | typedef const RTMAC RT_FAR *PCRTMAC;
|
---|
3542 |
|
---|
3543 |
|
---|
3544 | /** Pointer to a lock validator record.
|
---|
3545 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
3546 | typedef struct RTLOCKVALRECEXCL RT_FAR *PRTLOCKVALRECEXCL;
|
---|
3547 | /** Pointer to a record of one ownership share.
|
---|
3548 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
3549 | typedef struct RTLOCKVALRECSHRD RT_FAR *PRTLOCKVALRECSHRD;
|
---|
3550 | /** Pointer to a lock validator source position.
|
---|
3551 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
3552 | typedef struct RTLOCKVALSRCPOS RT_FAR *PRTLOCKVALSRCPOS;
|
---|
3553 | /** Pointer to a const lock validator source position.
|
---|
3554 | * The structure definition is found in iprt/lockvalidator.h. */
|
---|
3555 | typedef struct RTLOCKVALSRCPOS const RT_FAR *PCRTLOCKVALSRCPOS;
|
---|
3556 |
|
---|
3557 | /** @name Special sub-class values.
|
---|
3558 | * The range 16..UINT32_MAX is available to the user, the range 0..15 is
|
---|
3559 | * reserved for the lock validator. In the user range the locks can only be
|
---|
3560 | * taking in ascending order.
|
---|
3561 | * @{ */
|
---|
3562 | /** Invalid value. */
|
---|
3563 | #define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
|
---|
3564 | /** Not allowed to be taken with any other locks in the same class.
|
---|
3565 | * This is the recommended value. */
|
---|
3566 | #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
|
---|
3567 | /** Any order is allowed within the class. */
|
---|
3568 | #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
|
---|
3569 | /** The first user value. */
|
---|
3570 | #define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
|
---|
3571 | /** @} */
|
---|
3572 |
|
---|
3573 |
|
---|
3574 | /**
|
---|
3575 | * Digest types.
|
---|
3576 | */
|
---|
3577 | typedef enum RTDIGESTTYPE
|
---|
3578 | {
|
---|
3579 | /** Invalid digest value. */
|
---|
3580 | RTDIGESTTYPE_INVALID = 0,
|
---|
3581 | /** Unknown digest type. */
|
---|
3582 | RTDIGESTTYPE_UNKNOWN,
|
---|
3583 | /** CRC32 checksum. */
|
---|
3584 | RTDIGESTTYPE_CRC32,
|
---|
3585 | /** CRC64 checksum. */
|
---|
3586 | RTDIGESTTYPE_CRC64,
|
---|
3587 | /** MD2 checksum (unsafe!). */
|
---|
3588 | RTDIGESTTYPE_MD2,
|
---|
3589 | /** MD4 checksum (unsafe!!). */
|
---|
3590 | RTDIGESTTYPE_MD4,
|
---|
3591 | /** MD5 checksum (unsafe!). */
|
---|
3592 | RTDIGESTTYPE_MD5,
|
---|
3593 | /** SHA-1 checksum (unsafe!). */
|
---|
3594 | RTDIGESTTYPE_SHA1,
|
---|
3595 | /** SHA-224 checksum. */
|
---|
3596 | RTDIGESTTYPE_SHA224,
|
---|
3597 | /** SHA-256 checksum. */
|
---|
3598 | RTDIGESTTYPE_SHA256,
|
---|
3599 | /** SHA-384 checksum. */
|
---|
3600 | RTDIGESTTYPE_SHA384,
|
---|
3601 | /** SHA-512 checksum. */
|
---|
3602 | RTDIGESTTYPE_SHA512,
|
---|
3603 | /** SHA-512/224 checksum. */
|
---|
3604 | RTDIGESTTYPE_SHA512T224,
|
---|
3605 | /** SHA-512/256 checksum. */
|
---|
3606 | RTDIGESTTYPE_SHA512T256,
|
---|
3607 | /** SHA3-224 checksum. */
|
---|
3608 | RTDIGESTTYPE_SHA3_224,
|
---|
3609 | /** SHA3-256 checksum. */
|
---|
3610 | RTDIGESTTYPE_SHA3_256,
|
---|
3611 | /** SHA3-384 checksum. */
|
---|
3612 | RTDIGESTTYPE_SHA3_384,
|
---|
3613 | /** SHA3-512 checksum. */
|
---|
3614 | RTDIGESTTYPE_SHA3_512,
|
---|
3615 | #if 0
|
---|
3616 | /** SHAKE128 checksum. */
|
---|
3617 | RTDIGESTTYPE_SHAKE128,
|
---|
3618 | /** SHAKE256 checksum. */
|
---|
3619 | RTDIGESTTYPE_SHAKE256,
|
---|
3620 | #endif
|
---|
3621 | /** End of valid types. */
|
---|
3622 | RTDIGESTTYPE_END,
|
---|
3623 | /** Usual 32-bit type blowup. */
|
---|
3624 | RTDIGESTTYPE_32BIT_HACK = 0x7fffffff
|
---|
3625 | } RTDIGESTTYPE;
|
---|
3626 |
|
---|
3627 | /**
|
---|
3628 | * Process exit codes.
|
---|
3629 | */
|
---|
3630 | typedef enum RTEXITCODE
|
---|
3631 | {
|
---|
3632 | /** Success. */
|
---|
3633 | RTEXITCODE_SUCCESS = 0,
|
---|
3634 | /** General failure. */
|
---|
3635 | RTEXITCODE_FAILURE = 1,
|
---|
3636 | /** Invalid arguments. */
|
---|
3637 | RTEXITCODE_SYNTAX = 2,
|
---|
3638 | /** Initialization failure (usually IPRT, but could be used for other
|
---|
3639 | * components as well). */
|
---|
3640 | RTEXITCODE_INIT = 3,
|
---|
3641 | /** Test skipped. */
|
---|
3642 | RTEXITCODE_SKIPPED = 4,
|
---|
3643 | /** The end of valid exit codes. */
|
---|
3644 | RTEXITCODE_END,
|
---|
3645 | /** The usual 32-bit type hack. */
|
---|
3646 | RTEXITCODE_32BIT_HACK = 0x7fffffff
|
---|
3647 | } RTEXITCODE;
|
---|
3648 |
|
---|
3649 | /**
|
---|
3650 | * Range descriptor.
|
---|
3651 | */
|
---|
3652 | typedef struct RTRANGE
|
---|
3653 | {
|
---|
3654 | /** Start offset. */
|
---|
3655 | uint64_t offStart;
|
---|
3656 | /** Range size. */
|
---|
3657 | size_t cbRange;
|
---|
3658 | } RTRANGE;
|
---|
3659 | /** Pointer to a range descriptor. */
|
---|
3660 | typedef RTRANGE RT_FAR *PRTRANGE;
|
---|
3661 | /** Pointer to a readonly range descriptor. */
|
---|
3662 | typedef const RTRANGE RT_FAR *PCRTRANGE;
|
---|
3663 |
|
---|
3664 |
|
---|
3665 | /**
|
---|
3666 | * Generic pointer union.
|
---|
3667 | */
|
---|
3668 | typedef union RTPTRUNION
|
---|
3669 | {
|
---|
3670 | /** Pointer into the void. */
|
---|
3671 | void RT_FAR *pv;
|
---|
3672 | /** As a signed integer. */
|
---|
3673 | intptr_t i;
|
---|
3674 | /** As an unsigned integer. */
|
---|
3675 | uintptr_t u;
|
---|
3676 | /** Pointer to char value. */
|
---|
3677 | char RT_FAR *pch;
|
---|
3678 | /** Pointer to char value. */
|
---|
3679 | unsigned char RT_FAR *puch;
|
---|
3680 | /** Pointer to a int value. */
|
---|
3681 | int RT_FAR *pi;
|
---|
3682 | /** Pointer to a unsigned int value. */
|
---|
3683 | unsigned int RT_FAR *pu;
|
---|
3684 | /** Pointer to a long value. */
|
---|
3685 | long RT_FAR *pl;
|
---|
3686 | /** Pointer to a long value. */
|
---|
3687 | unsigned long RT_FAR *pul;
|
---|
3688 | /** Pointer to a 8-bit unsigned value. */
|
---|
3689 | uint8_t RT_FAR *pu8;
|
---|
3690 | /** Pointer to a 16-bit unsigned value. */
|
---|
3691 | uint16_t RT_FAR *pu16;
|
---|
3692 | /** Pointer to a 32-bit unsigned value. */
|
---|
3693 | uint32_t RT_FAR *pu32;
|
---|
3694 | /** Pointer to a 64-bit unsigned value. */
|
---|
3695 | uint64_t RT_FAR *pu64;
|
---|
3696 | /** Pointer to a 8-bit signed value. */
|
---|
3697 | int8_t RT_FAR *pi8;
|
---|
3698 | /** Pointer to a 16-bit signed value. */
|
---|
3699 | int16_t RT_FAR *pi16;
|
---|
3700 | /** Pointer to a 32-bit signed value. */
|
---|
3701 | int32_t RT_FAR *pi32;
|
---|
3702 | /** Pointer to a 64-bit signed value. */
|
---|
3703 | int64_t RT_FAR *pi64;
|
---|
3704 | /** Pointer to a UTF-16 character. */
|
---|
3705 | PRTUTF16 pwc;
|
---|
3706 | /** Pointer to a UUID character. */
|
---|
3707 | PRTUUID pUuid;
|
---|
3708 | } RTPTRUNION;
|
---|
3709 | /** Pointer to a pointer union. */
|
---|
3710 | typedef RTPTRUNION RT_FAR *PRTPTRUNION;
|
---|
3711 |
|
---|
3712 | /**
|
---|
3713 | * Generic const pointer union.
|
---|
3714 | */
|
---|
3715 | typedef union RTCPTRUNION
|
---|
3716 | {
|
---|
3717 | /** Pointer into the void. */
|
---|
3718 | void const RT_FAR *pv;
|
---|
3719 | /** As a signed integer. */
|
---|
3720 | intptr_t i;
|
---|
3721 | /** As an unsigned integer. */
|
---|
3722 | uintptr_t u;
|
---|
3723 | /** Pointer to char value. */
|
---|
3724 | char const RT_FAR *pch;
|
---|
3725 | /** Pointer to char value. */
|
---|
3726 | unsigned char const RT_FAR *puch;
|
---|
3727 | /** Pointer to a int value. */
|
---|
3728 | int const RT_FAR *pi;
|
---|
3729 | /** Pointer to a unsigned int value. */
|
---|
3730 | unsigned int const RT_FAR *pu;
|
---|
3731 | /** Pointer to a long value. */
|
---|
3732 | long const RT_FAR *pl;
|
---|
3733 | /** Pointer to a long value. */
|
---|
3734 | unsigned long const RT_FAR *pul;
|
---|
3735 | /** Pointer to a 8-bit unsigned value. */
|
---|
3736 | uint8_t const RT_FAR *pu8;
|
---|
3737 | /** Pointer to a 16-bit unsigned value. */
|
---|
3738 | uint16_t const RT_FAR *pu16;
|
---|
3739 | /** Pointer to a 32-bit unsigned value. */
|
---|
3740 | uint32_t const RT_FAR *pu32;
|
---|
3741 | /** Pointer to a 64-bit unsigned value. */
|
---|
3742 | uint64_t const RT_FAR *pu64;
|
---|
3743 | /** Pointer to a 8-bit signed value. */
|
---|
3744 | int8_t const RT_FAR *pi8;
|
---|
3745 | /** Pointer to a 16-bit signed value. */
|
---|
3746 | int16_t const RT_FAR *pi16;
|
---|
3747 | /** Pointer to a 32-bit signed value. */
|
---|
3748 | int32_t const RT_FAR *pi32;
|
---|
3749 | /** Pointer to a 64-bit signed value. */
|
---|
3750 | int64_t const RT_FAR *pi64;
|
---|
3751 | /** Pointer to a UTF-16 character. */
|
---|
3752 | PCRTUTF16 pwc;
|
---|
3753 | /** Pointer to a UUID character. */
|
---|
3754 | PCRTUUID pUuid;
|
---|
3755 | } RTCPTRUNION;
|
---|
3756 | /** Pointer to a const pointer union. */
|
---|
3757 | typedef RTCPTRUNION RT_FAR *PRTCPTRUNION;
|
---|
3758 |
|
---|
3759 | /**
|
---|
3760 | * Generic volatile pointer union.
|
---|
3761 | */
|
---|
3762 | typedef union RTVPTRUNION
|
---|
3763 | {
|
---|
3764 | /** Pointer into the void. */
|
---|
3765 | void volatile RT_FAR *pv;
|
---|
3766 | /** As a signed integer. */
|
---|
3767 | intptr_t i;
|
---|
3768 | /** As an unsigned integer. */
|
---|
3769 | uintptr_t u;
|
---|
3770 | /** Pointer to char value. */
|
---|
3771 | char volatile RT_FAR *pch;
|
---|
3772 | /** Pointer to char value. */
|
---|
3773 | unsigned char volatile RT_FAR *puch;
|
---|
3774 | /** Pointer to a int value. */
|
---|
3775 | int volatile RT_FAR *pi;
|
---|
3776 | /** Pointer to a unsigned int value. */
|
---|
3777 | unsigned int volatile RT_FAR *pu;
|
---|
3778 | /** Pointer to a long value. */
|
---|
3779 | long volatile RT_FAR *pl;
|
---|
3780 | /** Pointer to a long value. */
|
---|
3781 | unsigned long volatile RT_FAR *pul;
|
---|
3782 | /** Pointer to a 8-bit unsigned value. */
|
---|
3783 | uint8_t volatile RT_FAR *pu8;
|
---|
3784 | /** Pointer to a 16-bit unsigned value. */
|
---|
3785 | uint16_t volatile RT_FAR *pu16;
|
---|
3786 | /** Pointer to a 32-bit unsigned value. */
|
---|
3787 | uint32_t volatile RT_FAR *pu32;
|
---|
3788 | /** Pointer to a 64-bit unsigned value. */
|
---|
3789 | uint64_t volatile RT_FAR *pu64;
|
---|
3790 | /** Pointer to a 8-bit signed value. */
|
---|
3791 | int8_t volatile RT_FAR *pi8;
|
---|
3792 | /** Pointer to a 16-bit signed value. */
|
---|
3793 | int16_t volatile RT_FAR *pi16;
|
---|
3794 | /** Pointer to a 32-bit signed value. */
|
---|
3795 | int32_t volatile RT_FAR *pi32;
|
---|
3796 | /** Pointer to a 64-bit signed value. */
|
---|
3797 | int64_t volatile RT_FAR *pi64;
|
---|
3798 | /** Pointer to a UTF-16 character. */
|
---|
3799 | RTUTF16 volatile RT_FAR *pwc;
|
---|
3800 | /** Pointer to a UUID character. */
|
---|
3801 | RTUUID volatile RT_FAR *pUuid;
|
---|
3802 | } RTVPTRUNION;
|
---|
3803 | /** Pointer to a const pointer union. */
|
---|
3804 | typedef RTVPTRUNION RT_FAR *PRTVPTRUNION;
|
---|
3805 |
|
---|
3806 | /**
|
---|
3807 | * Generic const volatile pointer union.
|
---|
3808 | */
|
---|
3809 | typedef union RTCVPTRUNION
|
---|
3810 | {
|
---|
3811 | /** Pointer into the void. */
|
---|
3812 | void const volatile RT_FAR *pv;
|
---|
3813 | /** As a signed integer. */
|
---|
3814 | intptr_t i;
|
---|
3815 | /** As an unsigned integer. */
|
---|
3816 | uintptr_t u;
|
---|
3817 | /** Pointer to char value. */
|
---|
3818 | char const volatile RT_FAR *pch;
|
---|
3819 | /** Pointer to char value. */
|
---|
3820 | unsigned char const volatile RT_FAR *puch;
|
---|
3821 | /** Pointer to a int value. */
|
---|
3822 | int const volatile RT_FAR *pi;
|
---|
3823 | /** Pointer to a unsigned int value. */
|
---|
3824 | unsigned int const volatile RT_FAR *pu;
|
---|
3825 | /** Pointer to a long value. */
|
---|
3826 | long const volatile RT_FAR *pl;
|
---|
3827 | /** Pointer to a long value. */
|
---|
3828 | unsigned long const volatile RT_FAR *pul;
|
---|
3829 | /** Pointer to a 8-bit unsigned value. */
|
---|
3830 | uint8_t const volatile RT_FAR *pu8;
|
---|
3831 | /** Pointer to a 16-bit unsigned value. */
|
---|
3832 | uint16_t const volatile RT_FAR *pu16;
|
---|
3833 | /** Pointer to a 32-bit unsigned value. */
|
---|
3834 | uint32_t const volatile RT_FAR *pu32;
|
---|
3835 | /** Pointer to a 64-bit unsigned value. */
|
---|
3836 | uint64_t const volatile RT_FAR *pu64;
|
---|
3837 | /** Pointer to a 8-bit signed value. */
|
---|
3838 | int8_t const volatile RT_FAR *pi8;
|
---|
3839 | /** Pointer to a 16-bit signed value. */
|
---|
3840 | int16_t const volatile RT_FAR *pi16;
|
---|
3841 | /** Pointer to a 32-bit signed value. */
|
---|
3842 | int32_t const volatile RT_FAR *pi32;
|
---|
3843 | /** Pointer to a 64-bit signed value. */
|
---|
3844 | int64_t const volatile RT_FAR *pi64;
|
---|
3845 | /** Pointer to a UTF-16 character. */
|
---|
3846 | RTUTF16 const volatile RT_FAR *pwc;
|
---|
3847 | /** Pointer to a UUID character. */
|
---|
3848 | RTUUID const volatile RT_FAR *pUuid;
|
---|
3849 | } RTCVPTRUNION;
|
---|
3850 | /** Pointer to a const pointer union. */
|
---|
3851 | typedef RTCVPTRUNION RT_FAR *PRTCVPTRUNION;
|
---|
3852 |
|
---|
3853 |
|
---|
3854 |
|
---|
3855 | #ifdef __cplusplus
|
---|
3856 | /**
|
---|
3857 | * Strict type validation helper class.
|
---|
3858 | *
|
---|
3859 | * See RTErrStrictType and RT_SUCCESS_NP.
|
---|
3860 | */
|
---|
3861 | class RTErrStrictType2
|
---|
3862 | {
|
---|
3863 | protected:
|
---|
3864 | /** The status code. */
|
---|
3865 | int32_t m_rc;
|
---|
3866 |
|
---|
3867 | public:
|
---|
3868 | /**
|
---|
3869 | * Constructor.
|
---|
3870 | * @param rc IPRT style status code.
|
---|
3871 | */
|
---|
3872 | RTErrStrictType2(int32_t rc) : m_rc(rc)
|
---|
3873 | {
|
---|
3874 | }
|
---|
3875 |
|
---|
3876 | /**
|
---|
3877 | * Get the status code.
|
---|
3878 | * @returns IPRT style status code.
|
---|
3879 | */
|
---|
3880 | int32_t getValue() const
|
---|
3881 | {
|
---|
3882 | return m_rc;
|
---|
3883 | }
|
---|
3884 | };
|
---|
3885 | #endif /* __cplusplus */
|
---|
3886 | /** @} */
|
---|
3887 |
|
---|
3888 | #define IPRT_COMPLETED_types_h /* hack for watcom and nocrt headers depending on this one. */
|
---|
3889 | #endif /* !IPRT_INCLUDED_types_h */
|
---|
3890 |
|
---|