VirtualBox

source: vbox/trunk/include/iprt/types.h@ 94676

Last change on this file since 94676 was 94676, checked in by vboxsync, 3 years ago

iprt/types.h: Added RTFLOAT80U_IS_XXXX_EX macro variants that works on component parts rather than PCRTFLOAT80U. bugref:9898

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette