VirtualBox

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

Last change on this file since 95897 was 95448, checked in by vboxsync, 2 years ago

iprt/types.h: Added signed views to the RTUINT*U unions. Needed for AVX/SSE/MMX. bugref:9898

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

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