VirtualBox

source: vbox/trunk/include/iprt/cdefs.h@ 60007

Last change on this file since 60007 was 60007, checked in by vboxsync, 9 years ago

iprt/cdefs.h: RT_ARCH_XXX and ARCH_BITS checks.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 139.7 KB
Line 
1/** @file
2 * IPRT - Common C and C++ definitions.
3 */
4
5/*
6 * Copyright (C) 2006-2015 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_cdefs_h
27#define ___iprt_cdefs_h
28
29
30/** @defgroup grp_rt_cdefs IPRT Common Definitions and Macros
31 * @{
32 */
33
34/** @def RT_C_DECLS_BEGIN
35 * Used to start a block of function declarations which are shared
36 * between C and C++ program.
37 */
38
39/** @def RT_C_DECLS_END
40 * Used to end a block of function declarations which are shared
41 * between C and C++ program.
42 */
43
44#if defined(__cplusplus)
45# define RT_C_DECLS_BEGIN extern "C" {
46# define RT_C_DECLS_END }
47#else
48# define RT_C_DECLS_BEGIN
49# define RT_C_DECLS_END
50#endif
51
52
53/*
54 * Shut up DOXYGEN warnings and guide it properly thru the code.
55 */
56#ifdef DOXYGEN_RUNNING
57# define __AMD64__
58# define __X86__
59# define RT_ARCH_AMD64
60# define RT_ARCH_X86
61# define RT_ARCH_SPARC
62# define RT_ARCH_SPARC64
63# define IN_RING0
64# define IN_RING3
65# define IN_RC
66# define IN_RC
67# define IN_RT_RC
68# define IN_RT_R0
69# define IN_RT_R3
70# define IN_RT_STATIC
71# define RT_STRICT
72# define RT_NO_STRICT
73# define RT_LOCK_STRICT
74# define RT_LOCK_NO_STRICT
75# define RT_LOCK_STRICT_ORDER
76# define RT_LOCK_NO_STRICT_ORDER
77# define RT_BREAKPOINT
78# define RT_NO_DEPRECATED_MACROS
79# define RT_EXCEPTIONS_ENABLED
80# define RT_BIG_ENDIAN
81# define RT_LITTLE_ENDIAN
82# define RT_COMPILER_GROKS_64BIT_BITFIELDS
83# define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
84# define RT_NO_VISIBILITY_HIDDEN
85# define RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
86# define RT_COMPILER_SUPPORTS_VA_ARGS
87# define RT_COMPILER_SUPPORTS_LAMBDA
88#endif /* DOXYGEN_RUNNING */
89
90/** @def RT_ARCH_X86
91 * Indicates that we're compiling for the X86 architecture.
92 */
93
94/** @def RT_ARCH_AMD64
95 * Indicates that we're compiling for the AMD64 architecture.
96 */
97
98/** @def RT_ARCH_SPARC
99 * Indicates that we're compiling for the SPARC V8 architecture (32-bit).
100 */
101
102/** @def RT_ARCH_SPARC64
103 * Indicates that we're compiling for the SPARC V9 architecture (64-bit).
104 */
105#if !defined(RT_ARCH_X86) \
106 && !defined(RT_ARCH_AMD64) \
107 && !defined(RT_ARCH_SPARC) \
108 && !defined(RT_ARCH_SPARC64) \
109 && !defined(RT_ARCH_ARM)
110# if defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__)
111# define RT_ARCH_AMD64
112# elif defined(__i386__) || defined(_M_IX86) || defined(__X86__)
113# define RT_ARCH_X86
114# elif defined(__sparcv9)
115# define RT_ARCH_SPARC64
116# elif defined(__sparc__)
117# define RT_ARCH_SPARC
118# elif defined(__arm__) || defined(__arm32__)
119# define RT_ARCH_ARM
120# else /* PORTME: append test for new archs. */
121# error "Check what predefined macros your compiler uses to indicate architecture."
122# endif
123/* PORTME: append new archs checks. */
124#elif defined(RT_ARCH_X86) && defined(RT_ARCH_AMD64)
125# error "Both RT_ARCH_X86 and RT_ARCH_AMD64 cannot be defined at the same time!"
126#elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC)
127# error "Both RT_ARCH_X86 and RT_ARCH_SPARC cannot be defined at the same time!"
128#elif defined(RT_ARCH_X86) && defined(RT_ARCH_SPARC64)
129# error "Both RT_ARCH_X86 and RT_ARCH_SPARC64 cannot be defined at the same time!"
130#elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC)
131# error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC cannot be defined at the same time!"
132#elif defined(RT_ARCH_AMD64) && defined(RT_ARCH_SPARC64)
133# error "Both RT_ARCH_AMD64 and RT_ARCH_SPARC64 cannot be defined at the same time!"
134#elif defined(RT_ARCH_SPARC) && defined(RT_ARCH_SPARC64)
135# error "Both RT_ARCH_SPARC and RT_ARCH_SPARC64 cannot be defined at the same time!"
136#elif defined(RT_ARCH_ARM) && defined(RT_ARCH_AMD64)
137# error "Both RT_ARCH_ARM and RT_ARCH_AMD64 cannot be defined at the same time!"
138#elif defined(RT_ARCH_ARM) && defined(RT_ARCH_X86)
139# error "Both RT_ARCH_ARM and RT_ARCH_X86 cannot be defined at the same time!"
140#elif defined(RT_ARCH_ARM) && defined(RT_ARCH_SPARC64)
141# error "Both RT_ARCH_ARM and RT_ARCH_SPARC64 cannot be defined at the same time!"
142#elif defined(RT_ARCH_ARM) && defined(RT_ARCH_SPARC)
143# error "Both RT_ARCH_ARM and RT_ARCH_SPARC cannot be defined at the same time!"
144#endif
145
146/* Final check (PORTME). */
147#if (defined(RT_ARCH_X86) != 0) \
148 + (defined(RT_ARCH_AMD64) != 0) \
149 + (defined(RT_ARCH_SPARC) != 0) \
150 + (defined(RT_ARCH_SPARC64) != 0) \
151 + (defined(RT_ARCH_ARM) != 0) \
152 != 1
153# error "Exactly one RT_ARCH_XXX macro shall be defined"
154#endif
155
156
157/** @def __X86__
158 * Indicates that we're compiling for the X86 architecture.
159 * @deprecated
160 */
161
162/** @def __AMD64__
163 * Indicates that we're compiling for the AMD64 architecture.
164 * @deprecated
165 */
166#if !defined(__X86__) && !defined(__AMD64__) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
167# if defined(RT_ARCH_AMD64)
168# define __AMD64__
169# elif defined(RT_ARCH_X86)
170# define __X86__
171# else
172# error "Check what predefined macros your compiler uses to indicate architecture."
173# endif
174#elif defined(__X86__) && defined(__AMD64__)
175# error "Both __X86__ and __AMD64__ cannot be defined at the same time!"
176#elif defined(__X86__) && !defined(RT_ARCH_X86)
177# error "__X86__ without RT_ARCH_X86!"
178#elif defined(__AMD64__) && !defined(RT_ARCH_AMD64)
179# error "__AMD64__ without RT_ARCH_AMD64!"
180#endif
181
182/** @def RT_BIG_ENDIAN
183 * Defined if the architecture is big endian. */
184/** @def RT_LITTLE_ENDIAN
185 * Defined if the architecture is little endian. */
186#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) || defined(RT_ARCH_ARM)
187# define RT_LITTLE_ENDIAN
188#elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
189# define RT_BIG_ENDIAN
190#else
191# error "PORTME: architecture endianess"
192#endif
193#if defined(RT_BIG_ENDIAN) && defined(RT_LITTLE_ENDIAN)
194# error "Both RT_BIG_ENDIAN and RT_LITTLE_ENDIAN are defined"
195#endif
196
197
198/** @def IN_RING0
199 * Used to indicate that we're compiling code which is running
200 * in Ring-0 Host Context.
201 */
202
203/** @def IN_RING3
204 * Used to indicate that we're compiling code which is running
205 * in Ring-3 Host Context.
206 */
207
208/** @def IN_RC
209 * Used to indicate that we're compiling code which is running
210 * in the Raw-mode Context (implies R0).
211 */
212#if !defined(IN_RING3) && !defined(IN_RING0) && !defined(IN_RC) && !defined(IN_RC)
213# error "You must define which context the compiled code should run in; IN_RING3, IN_RING0 or IN_RC"
214#endif
215#if (defined(IN_RING3) && (defined(IN_RING0) || defined(IN_RC)) ) \
216 || (defined(IN_RING0) && (defined(IN_RING3) || defined(IN_RC)) ) \
217 || (defined(IN_RC) && (defined(IN_RING3) || defined(IN_RING0)) )
218# error "Only one of the IN_RING3, IN_RING0, IN_RC defines should be defined."
219#endif
220
221
222/** @def ARCH_BITS
223 * Defines the bit count of the current context.
224 */
225#if !defined(ARCH_BITS) || defined(DOXYGEN_RUNNING)
226# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
227# define ARCH_BITS 64
228# elif !defined(__I86__) || !defined(__WATCOMC__)
229# define ARCH_BITS 32
230# else
231# define ARCH_BITS 16
232# endif
233#endif
234
235/* ARCH_BITS validation (PORTME). */
236#if ARCH_BITS == 64
237 #if defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_ARM)
238 # error "ARCH_BITS=64 but non-64-bit RT_ARCH_XXX defined."
239 #endif
240 #if !defined(RT_ARCH_AMD64) && !defined(RT_ARCH_SPARC64)
241 # error "ARCH_BITS=64 but no 64-bit RT_ARCH_XXX defined."
242 #endif
243
244#elif ARCH_BITS == 32
245 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
246 # error "ARCH_BITS=32 but non-32-bit RT_ARCH_XXX defined."
247 #endif
248 #if !defined(RT_ARCH_X86) && !defined(RT_ARCH_SPARC) && !defined(RT_ARCH_ARM)
249 # error "ARCH_BITS=32 but no 32-bit RT_ARCH_XXX defined."
250 #endif
251
252#elif ARCH_BITS == 16
253 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64) || defined(RT_ARCH_ARM)
254 # error "ARCH_BITS=16 but non-16-bit RT_ARCH_XX defined."
255 #endif
256 #if !defined(RT_ARCH_X86)
257 # error "ARCH_BITS=16 but RT_ARCH_X86 isn't defined."
258 #endif
259
260#else
261# error "Unsupported ARCH_BITS value!"
262#endif
263
264/** @def HC_ARCH_BITS
265 * Defines the host architecture bit count.
266 */
267#if !defined(HC_ARCH_BITS) || defined(DOXYGEN_RUNNING)
268# ifndef IN_RC
269# define HC_ARCH_BITS ARCH_BITS
270# else
271# define HC_ARCH_BITS 32
272# endif
273#endif
274
275/** @def GC_ARCH_BITS
276 * Defines the guest architecture bit count.
277 */
278#if !defined(GC_ARCH_BITS) && !defined(DOXYGEN_RUNNING)
279# ifdef VBOX_WITH_64_BITS_GUESTS
280# define GC_ARCH_BITS 64
281# else
282# define GC_ARCH_BITS 32
283# endif
284#endif
285
286/** @def R3_ARCH_BITS
287 * Defines the host ring-3 architecture bit count.
288 */
289#if !defined(R3_ARCH_BITS) || defined(DOXYGEN_RUNNING)
290# ifdef IN_RING3
291# define R3_ARCH_BITS ARCH_BITS
292# else
293# define R3_ARCH_BITS HC_ARCH_BITS
294# endif
295#endif
296
297/** @def R0_ARCH_BITS
298 * Defines the host ring-0 architecture bit count.
299 */
300#if !defined(R0_ARCH_BITS) || defined(DOXYGEN_RUNNING)
301# ifdef IN_RING0
302# define R0_ARCH_BITS ARCH_BITS
303# else
304# define R0_ARCH_BITS HC_ARCH_BITS
305# endif
306#endif
307
308/** @def GC_ARCH_BITS
309 * Defines the guest architecture bit count.
310 */
311#if !defined(GC_ARCH_BITS) || defined(DOXYGEN_RUNNING)
312# ifdef IN_RC
313# define GC_ARCH_BITS ARCH_BITS
314# else
315# define GC_ARCH_BITS 32
316# endif
317#endif
318
319
320
321/** @name RT_OPSYS_XXX - Operative System Identifiers.
322 * These are the value that the RT_OPSYS \#define can take. @{
323 */
324/** Unknown OS. */
325#define RT_OPSYS_UNKNOWN 0
326/** OS Agnostic. */
327#define RT_OPSYS_AGNOSTIC 1
328/** Darwin - aka Mac OS X. */
329#define RT_OPSYS_DARWIN 2
330/** DragonFly BSD. */
331#define RT_OPSYS_DRAGONFLY 3
332/** DOS. */
333#define RT_OPSYS_DOS 4
334/** FreeBSD. */
335#define RT_OPSYS_FREEBSD 5
336/** Haiku. */
337#define RT_OPSYS_HAIKU 6
338/** Linux. */
339#define RT_OPSYS_LINUX 7
340/** L4. */
341#define RT_OPSYS_L4 8
342/** Minix. */
343#define RT_OPSYS_MINIX 9
344/** NetBSD. */
345#define RT_OPSYS_NETBSD 11
346/** Netware. */
347#define RT_OPSYS_NETWARE 12
348/** NT (native). */
349#define RT_OPSYS_NT 13
350/** OpenBSD. */
351#define RT_OPSYS_OPENBSD 14
352/** OS/2. */
353#define RT_OPSYS_OS2 15
354/** Plan 9. */
355#define RT_OPSYS_PLAN9 16
356/** QNX. */
357#define RT_OPSYS_QNX 17
358/** Solaris. */
359#define RT_OPSYS_SOLARIS 18
360/** UEFI. */
361#define RT_OPSYS_UEFI 19
362/** Windows. */
363#define RT_OPSYS_WINDOWS 20
364/** The max RT_OPSYS_XXX value (exclusive). */
365#define RT_OPSYS_MAX 21
366/** @} */
367
368/** @def RT_OPSYS
369 * Indicates which OS we're targeting. It's a \#define with is
370 * assigned one of the RT_OPSYS_XXX defines above.
371 *
372 * So to test if we're on FreeBSD do the following:
373 * @code
374 * #if RT_OPSYS == RT_OPSYS_FREEBSD
375 * some_funky_freebsd_specific_stuff();
376 * #endif
377 * @endcode
378 */
379
380/*
381 * Set RT_OPSYS_XXX according to RT_OS_XXX.
382 *
383 * Search: #define RT_OPSYS_([A-Z0-9]+) .*
384 * Replace: # elif defined(RT_OS_\1)\n# define RT_OPSYS RT_OPSYS_\1
385 */
386#ifndef RT_OPSYS
387# if defined(RT_OS_UNKNOWN) || defined(DOXYGEN_RUNNING)
388# define RT_OPSYS RT_OPSYS_UNKNOWN
389# elif defined(RT_OS_AGNOSTIC)
390# define RT_OPSYS RT_OPSYS_AGNOSTIC
391# elif defined(RT_OS_DARWIN)
392# define RT_OPSYS RT_OPSYS_DARWIN
393# elif defined(RT_OS_DRAGONFLY)
394# define RT_OPSYS RT_OPSYS_DRAGONFLY
395# elif defined(RT_OS_DOS)
396# define RT_OPSYS RT_OPSYS_DOS
397# elif defined(RT_OS_FREEBSD)
398# define RT_OPSYS RT_OPSYS_FREEBSD
399# elif defined(RT_OS_HAIKU)
400# define RT_OPSYS RT_OPSYS_HAIKU
401# elif defined(RT_OS_LINUX)
402# define RT_OPSYS RT_OPSYS_LINUX
403# elif defined(RT_OS_L4)
404# define RT_OPSYS RT_OPSYS_L4
405# elif defined(RT_OS_MINIX)
406# define RT_OPSYS RT_OPSYS_MINIX
407# elif defined(RT_OS_NETBSD)
408# define RT_OPSYS RT_OPSYS_NETBSD
409# elif defined(RT_OS_NETWARE)
410# define RT_OPSYS RT_OPSYS_NETWARE
411# elif defined(RT_OS_NT)
412# define RT_OPSYS RT_OPSYS_NT
413# elif defined(RT_OS_OPENBSD)
414# define RT_OPSYS RT_OPSYS_OPENBSD
415# elif defined(RT_OS_OS2)
416# define RT_OPSYS RT_OPSYS_OS2
417# elif defined(RT_OS_PLAN9)
418# define RT_OPSYS RT_OPSYS_PLAN9
419# elif defined(RT_OS_QNX)
420# define RT_OPSYS RT_OPSYS_QNX
421# elif defined(RT_OS_SOLARIS)
422# define RT_OPSYS RT_OPSYS_SOLARIS
423# elif defined(RT_OS_UEFI)
424# define RT_OPSYS RT_OPSYS_UEFI
425# elif defined(RT_OS_WINDOWS)
426# define RT_OPSYS RT_OPSYS_WINDOWS
427# endif
428#endif
429
430/*
431 * Guess RT_OPSYS based on compiler predefined macros.
432 */
433#ifndef RT_OPSYS
434# if defined(__APPLE__)
435# define RT_OPSYS RT_OPSYS_DARWIN
436# elif defined(__DragonFly__)
437# define RT_OPSYS RT_OPSYS_DRAGONFLY
438# elif defined(__FreeBSD__) /*??*/
439# define RT_OPSYS RT_OPSYS_FREEBSD
440# elif defined(__gnu_linux__)
441# define RT_OPSYS RT_OPSYS_LINUX
442# elif defined(__NetBSD__) /*??*/
443# define RT_OPSYS RT_OPSYS_NETBSD
444# elif defined(__OpenBSD__) /*??*/
445# define RT_OPSYS RT_OPSYS_OPENBSD
446# elif defined(__OS2__)
447# define RT_OPSYS RT_OPSYS_OS2
448# elif defined(__sun__) || defined(__SunOS__) || defined(__sun) || defined(__SunOS)
449# define RT_OPSYS RT_OPSYS_SOLARIS
450# elif defined(_WIN32) || defined(_WIN64)
451# define RT_OPSYS RT_OPSYS_WINDOWS
452# elif defined(MSDOS) || defined(_MSDOS) || defined(DOS16RM) /* OW+MSC || MSC || DMC */
453# define RT_OPSYS RT_OPSYS_DOS
454# else
455# error "Port Me"
456# endif
457#endif
458
459#if RT_OPSYS < RT_OPSYS_UNKNOWN || RT_OPSYS >= RT_OPSYS_MAX
460# error "Invalid RT_OPSYS value."
461#endif
462
463/*
464 * Do some consistency checks.
465 *
466 * Search: #define RT_OPSYS_([A-Z0-9]+) .*
467 * Replace: #if defined(RT_OS_\1) && RT_OPSYS != RT_OPSYS_\1\n# error RT_OPSYS vs RT_OS_\1\n#endif
468 */
469#if defined(RT_OS_UNKNOWN) && RT_OPSYS != RT_OPSYS_UNKNOWN
470# error RT_OPSYS vs RT_OS_UNKNOWN
471#endif
472#if defined(RT_OS_AGNOSTIC) && RT_OPSYS != RT_OPSYS_AGNOSTIC
473# error RT_OPSYS vs RT_OS_AGNOSTIC
474#endif
475#if defined(RT_OS_DARWIN) && RT_OPSYS != RT_OPSYS_DARWIN
476# error RT_OPSYS vs RT_OS_DARWIN
477#endif
478#if defined(RT_OS_DRAGONFLY) && RT_OPSYS != RT_OPSYS_DRAGONFLY
479# error RT_OPSYS vs RT_OS_DRAGONFLY
480#endif
481#if defined(RT_OS_DOS) && RT_OPSYS != RT_OPSYS_DOS
482# error RT_OPSYS vs RT_OS_DOS
483#endif
484#if defined(RT_OS_FREEBSD) && RT_OPSYS != RT_OPSYS_FREEBSD
485# error RT_OPSYS vs RT_OS_FREEBSD
486#endif
487#if defined(RT_OS_HAIKU) && RT_OPSYS != RT_OPSYS_HAIKU
488# error RT_OPSYS vs RT_OS_HAIKU
489#endif
490#if defined(RT_OS_LINUX) && RT_OPSYS != RT_OPSYS_LINUX
491# error RT_OPSYS vs RT_OS_LINUX
492#endif
493#if defined(RT_OS_L4) && RT_OPSYS != RT_OPSYS_L4
494# error RT_OPSYS vs RT_OS_L4
495#endif
496#if defined(RT_OS_MINIX) && RT_OPSYS != RT_OPSYS_MINIX
497# error RT_OPSYS vs RT_OS_MINIX
498#endif
499#if defined(RT_OS_NETBSD) && RT_OPSYS != RT_OPSYS_NETBSD
500# error RT_OPSYS vs RT_OS_NETBSD
501#endif
502#if defined(RT_OS_NETWARE) && RT_OPSYS != RT_OPSYS_NETWARE
503# error RT_OPSYS vs RT_OS_NETWARE
504#endif
505#if defined(RT_OS_NT) && RT_OPSYS != RT_OPSYS_NT
506# error RT_OPSYS vs RT_OS_NT
507#endif
508#if defined(RT_OS_OPENBSD) && RT_OPSYS != RT_OPSYS_OPENBSD
509# error RT_OPSYS vs RT_OS_OPENBSD
510#endif
511#if defined(RT_OS_OS2) && RT_OPSYS != RT_OPSYS_OS2
512# error RT_OPSYS vs RT_OS_OS2
513#endif
514#if defined(RT_OS_PLAN9) && RT_OPSYS != RT_OPSYS_PLAN9
515# error RT_OPSYS vs RT_OS_PLAN9
516#endif
517#if defined(RT_OS_QNX) && RT_OPSYS != RT_OPSYS_QNX
518# error RT_OPSYS vs RT_OS_QNX
519#endif
520#if defined(RT_OS_SOLARIS) && RT_OPSYS != RT_OPSYS_SOLARIS
521# error RT_OPSYS vs RT_OS_SOLARIS
522#endif
523#if defined(RT_OS_UEFI) && RT_OPSYS != RT_OPSYS_UEFI
524# error RT_OPSYS vs RT_OS_UEFI
525#endif
526#if defined(RT_OS_WINDOWS) && RT_OPSYS != RT_OPSYS_WINDOWS
527# error RT_OPSYS vs RT_OS_WINDOWS
528#endif
529
530/*
531 * Make sure the RT_OS_XXX macro is defined.
532 *
533 * Search: #define RT_OPSYS_([A-Z0-9]+) .*
534 * Replace: #elif RT_OPSYS == RT_OPSYS_\1\n# ifndef RT_OS_\1\n# define RT_OS_\1\n# endif
535 */
536#if RT_OPSYS == RT_OPSYS_UNKNOWN
537# ifndef RT_OS_UNKNOWN
538# define RT_OS_UNKNOWN
539# endif
540#elif RT_OPSYS == RT_OPSYS_AGNOSTIC
541# ifndef RT_OS_AGNOSTIC
542# define RT_OS_AGNOSTIC
543# endif
544#elif RT_OPSYS == RT_OPSYS_DARWIN
545# ifndef RT_OS_DARWIN
546# define RT_OS_DARWIN
547# endif
548#elif RT_OPSYS == RT_OPSYS_DRAGONFLY
549# ifndef RT_OS_DRAGONFLY
550# define RT_OS_DRAGONFLY
551# endif
552#elif RT_OPSYS == RT_OPSYS_DOS
553# ifndef RT_OS_DOS
554# define RT_OS_DOS
555# endif
556#elif RT_OPSYS == RT_OPSYS_FREEBSD
557# ifndef RT_OS_FREEBSD
558# define RT_OS_FREEBSD
559# endif
560#elif RT_OPSYS == RT_OPSYS_HAIKU
561# ifndef RT_OS_HAIKU
562# define RT_OS_HAIKU
563# endif
564#elif RT_OPSYS == RT_OPSYS_LINUX
565# ifndef RT_OS_LINUX
566# define RT_OS_LINUX
567# endif
568#elif RT_OPSYS == RT_OPSYS_L4
569# ifndef RT_OS_L4
570# define RT_OS_L4
571# endif
572#elif RT_OPSYS == RT_OPSYS_MINIX
573# ifndef RT_OS_MINIX
574# define RT_OS_MINIX
575# endif
576#elif RT_OPSYS == RT_OPSYS_NETBSD
577# ifndef RT_OS_NETBSD
578# define RT_OS_NETBSD
579# endif
580#elif RT_OPSYS == RT_OPSYS_NETWARE
581# ifndef RT_OS_NETWARE
582# define RT_OS_NETWARE
583# endif
584#elif RT_OPSYS == RT_OPSYS_NT
585# ifndef RT_OS_NT
586# define RT_OS_NT
587# endif
588#elif RT_OPSYS == RT_OPSYS_OPENBSD
589# ifndef RT_OS_OPENBSD
590# define RT_OS_OPENBSD
591# endif
592#elif RT_OPSYS == RT_OPSYS_OS2
593# ifndef RT_OS_OS2
594# define RT_OS_OS2
595# endif
596#elif RT_OPSYS == RT_OPSYS_PLAN9
597# ifndef RT_OS_PLAN9
598# define RT_OS_PLAN9
599# endif
600#elif RT_OPSYS == RT_OPSYS_QNX
601# ifndef RT_OS_QNX
602# define RT_OS_QNX
603# endif
604#elif RT_OPSYS == RT_OPSYS_SOLARIS
605# ifndef RT_OS_SOLARIS
606# define RT_OS_SOLARIS
607# endif
608#elif RT_OPSYS == RT_OPSYS_UEFI
609# ifndef RT_OS_UEFI
610# define RT_OS_UEFI
611# endif
612#elif RT_OPSYS == RT_OPSYS_WINDOWS
613# ifndef RT_OS_WINDOWS
614# define RT_OS_WINDOWS
615# endif
616#else
617# error "Bad RT_OPSYS value."
618#endif
619
620
621/**
622 * Checks whether the given OpSys uses DOS-style paths or not.
623 *
624 * By DOS-style paths we include drive lettering and UNC paths.
625 *
626 * @returns true / false
627 * @param a_OpSys The RT_OPSYS_XXX value to check, will be reference
628 * multiple times.
629 */
630#define RT_OPSYS_USES_DOS_PATHS(a_OpSys) \
631 ( (a_OpSys) == RT_OPSYS_WINDOWS \
632 || (a_OpSys) == RT_OPSYS_OS2 \
633 || (a_OpSys) == RT_OPSYS_DOS )
634
635
636
637/** @def CTXTYPE
638 * Declare a type differently in GC, R3 and R0.
639 *
640 * @param GCType The GC type.
641 * @param R3Type The R3 type.
642 * @param R0Type The R0 type.
643 * @remark For pointers used only in one context use RCPTRTYPE(), R3R0PTRTYPE(), R3PTRTYPE() or R0PTRTYPE().
644 */
645#ifdef IN_RC
646# define CTXTYPE(GCType, R3Type, R0Type) GCType
647#elif defined(IN_RING3)
648# define CTXTYPE(GCType, R3Type, R0Type) R3Type
649#else
650# define CTXTYPE(GCType, R3Type, R0Type) R0Type
651#endif
652
653/** @def RCPTRTYPE
654 * Declare a pointer which is used in the raw mode context but appears in structure(s) used by
655 * both HC and RC. The main purpose is to make sure structures have the same
656 * size when built for different architectures.
657 *
658 * @param RCType The RC type.
659 */
660#define RCPTRTYPE(RCType) CTXTYPE(RCType, RTRCPTR, RTRCPTR)
661
662/** @def R3R0PTRTYPE
663 * Declare a pointer which is used in HC, is explicitly valid in ring 3 and 0,
664 * but appears in structure(s) used by both HC and GC. The main purpose is to
665 * make sure structures have the same size when built for different architectures.
666 *
667 * @param R3R0Type The R3R0 type.
668 * @remarks This used to be called HCPTRTYPE.
669 */
670#define R3R0PTRTYPE(R3R0Type) CTXTYPE(RTHCPTR, R3R0Type, R3R0Type)
671
672/** @def R3PTRTYPE
673 * Declare a pointer which is used in R3 but appears in structure(s) used by
674 * both HC and GC. The main purpose is to make sure structures have the same
675 * size when built for different architectures.
676 *
677 * @param R3Type The R3 type.
678 */
679#define R3PTRTYPE(R3Type) CTXTYPE(RTHCUINTPTR, R3Type, RTHCUINTPTR)
680
681/** @def R0PTRTYPE
682 * Declare a pointer which is used in R0 but appears in structure(s) used by
683 * both HC and GC. The main purpose is to make sure structures have the same
684 * size when built for different architectures.
685 *
686 * @param R0Type The R0 type.
687 */
688#define R0PTRTYPE(R0Type) CTXTYPE(RTHCUINTPTR, RTHCUINTPTR, R0Type)
689
690/** @def CTXSUFF
691 * Adds the suffix of the current context to the passed in
692 * identifier name. The suffix is HC or GC.
693 *
694 * This is macro should only be used in shared code to avoid a forest of ifdefs.
695 * @param var Identifier name.
696 * @deprecated Use CTX_SUFF. Do NOT use this for new code.
697 */
698/** @def OTHERCTXSUFF
699 * Adds the suffix of the other context to the passed in
700 * identifier name. The suffix is HC or GC.
701 *
702 * This is macro should only be used in shared code to avoid a forest of ifdefs.
703 * @param var Identifier name.
704 * @deprecated Use CTX_SUFF. Do NOT use this for new code.
705 */
706#ifdef IN_RC
707# define CTXSUFF(var) var##GC
708# define OTHERCTXSUFF(var) var##HC
709#else
710# define CTXSUFF(var) var##HC
711# define OTHERCTXSUFF(var) var##GC
712#endif
713
714/** @def CTXALLSUFF
715 * Adds the suffix of the current context to the passed in
716 * identifier name. The suffix is R3, R0 or GC.
717 *
718 * This is macro should only be used in shared code to avoid a forest of ifdefs.
719 * @param var Identifier name.
720 * @deprecated Use CTX_SUFF. Do NOT use this for new code.
721 */
722#ifdef IN_RC
723# define CTXALLSUFF(var) var##GC
724#elif defined(IN_RING0)
725# define CTXALLSUFF(var) var##R0
726#else
727# define CTXALLSUFF(var) var##R3
728#endif
729
730/** @def CTX_SUFF
731 * Adds the suffix of the current context to the passed in
732 * identifier name. The suffix is R3, R0 or RC.
733 *
734 * This is macro should only be used in shared code to avoid a forest of ifdefs.
735 * @param var Identifier name.
736 *
737 * @remark This will replace CTXALLSUFF and CTXSUFF before long.
738 */
739#ifdef IN_RC
740# define CTX_SUFF(var) var##RC
741#elif defined(IN_RING0)
742# define CTX_SUFF(var) var##R0
743#else
744# define CTX_SUFF(var) var##R3
745#endif
746
747/** @def CTX_SUFF_Z
748 * Adds the suffix of the current context to the passed in
749 * identifier name, combining RC and R0 into RZ.
750 * The suffix thus is R3 or RZ.
751 *
752 * This is macro should only be used in shared code to avoid a forest of ifdefs.
753 * @param var Identifier name.
754 *
755 * @remark This will replace CTXALLSUFF and CTXSUFF before long.
756 */
757#ifdef IN_RING3
758# define CTX_SUFF_Z(var) var##R3
759#else
760# define CTX_SUFF_Z(var) var##RZ
761#endif
762
763
764/** @def CTXMID
765 * Adds the current context as a middle name of an identifier name
766 * The middle name is HC or GC.
767 *
768 * This is macro should only be used in shared code to avoid a forest of ifdefs.
769 * @param first First name.
770 * @param last Surname.
771 */
772/** @def OTHERCTXMID
773 * Adds the other context as a middle name of an identifier name
774 * The middle name is HC or GC.
775 *
776 * This is macro should only be used in shared code to avoid a forest of ifdefs.
777 * @param first First name.
778 * @param last Surname.
779 * @deprecated use CTX_MID or CTX_MID_Z
780 */
781#ifdef IN_RC
782# define CTXMID(first, last) first##GC##last
783# define OTHERCTXMID(first, last) first##HC##last
784#else
785# define CTXMID(first, last) first##HC##last
786# define OTHERCTXMID(first, last) first##GC##last
787#endif
788
789/** @def CTXALLMID
790 * Adds the current context as a middle name of an identifier name.
791 * The middle name is R3, R0 or GC.
792 *
793 * This is macro should only be used in shared code to avoid a forest of ifdefs.
794 * @param first First name.
795 * @param last Surname.
796 * @deprecated use CTX_MID or CTX_MID_Z
797 */
798#ifdef IN_RC
799# define CTXALLMID(first, last) first##GC##last
800#elif defined(IN_RING0)
801# define CTXALLMID(first, last) first##R0##last
802#else
803# define CTXALLMID(first, last) first##R3##last
804#endif
805
806/** @def CTX_MID
807 * Adds the current context as a middle name of an identifier name.
808 * The middle name is R3, R0 or RC.
809 *
810 * This is macro should only be used in shared code to avoid a forest of ifdefs.
811 * @param first First name.
812 * @param last Surname.
813 */
814#ifdef IN_RC
815# define CTX_MID(first, last) first##RC##last
816#elif defined(IN_RING0)
817# define CTX_MID(first, last) first##R0##last
818#else
819# define CTX_MID(first, last) first##R3##last
820#endif
821
822/** @def CTX_MID_Z
823 * Adds the current context as a middle name of an identifier name, combining RC
824 * and R0 into RZ.
825 * The middle name thus is either R3 or RZ.
826 *
827 * This is macro should only be used in shared code to avoid a forest of ifdefs.
828 * @param first First name.
829 * @param last Surname.
830 */
831#ifdef IN_RING3
832# define CTX_MID_Z(first, last) first##R3##last
833#else
834# define CTX_MID_Z(first, last) first##RZ##last
835#endif
836
837
838/** @def R3STRING
839 * A macro which in GC and R0 will return a dummy string while in R3 it will return
840 * the parameter.
841 *
842 * This is typically used to wrap description strings in structures shared
843 * between R3, R0 and/or GC. The intention is to avoid the \#ifdef IN_RING3 mess.
844 *
845 * @param pR3String The R3 string. Only referenced in R3.
846 * @see R0STRING and GCSTRING
847 */
848#ifdef IN_RING3
849# define R3STRING(pR3String) (pR3String)
850#else
851# define R3STRING(pR3String) ("<R3_STRING>")
852#endif
853
854/** @def R0STRING
855 * A macro which in GC and R3 will return a dummy string while in R0 it will return
856 * the parameter.
857 *
858 * This is typically used to wrap description strings in structures shared
859 * between R3, R0 and/or GC. The intention is to avoid the \#ifdef IN_RING0 mess.
860 *
861 * @param pR0String The R0 string. Only referenced in R0.
862 * @see R3STRING and GCSTRING
863 */
864#ifdef IN_RING0
865# define R0STRING(pR0String) (pR0String)
866#else
867# define R0STRING(pR0String) ("<R0_STRING>")
868#endif
869
870/** @def RCSTRING
871 * A macro which in R3 and R0 will return a dummy string while in RC it will return
872 * the parameter.
873 *
874 * This is typically used to wrap description strings in structures shared
875 * between R3, R0 and/or RC. The intention is to avoid the \#ifdef IN_RC mess.
876 *
877 * @param pRCString The RC string. Only referenced in RC.
878 * @see R3STRING, R0STRING
879 */
880#ifdef IN_RC
881# define RCSTRING(pRCString) (pRCString)
882#else
883# define RCSTRING(pRCString) ("<RC_STRING>")
884#endif
885
886
887/** @def RT_NOTHING
888 * A macro that expands to nothing.
889 * This is primarily intended as a dummy argument for macros to avoid the
890 * undefined behavior passing empty arguments to an macro (ISO C90 and C++98,
891 * gcc v4.4 warns about it).
892 */
893#define RT_NOTHING
894
895/** @def RT_GCC_EXTENSION
896 * Macro for shutting up GCC warnings about using language extensions. */
897#ifdef __GNUC__
898# define RT_GCC_EXTENSION __extension__
899#else
900# define RT_GCC_EXTENSION
901#endif
902
903/** @def RT_COMPILER_GROKS_64BIT_BITFIELDS
904 * Macro that is defined if the compiler understands 64-bit bitfields. */
905#if !defined(RT_OS_OS2) || (!defined(__IBMC__) && !defined(__IBMCPP__))
906# if !defined(__WATCOMC__) /* watcom compiler doesn't grok it either. */
907# define RT_COMPILER_GROKS_64BIT_BITFIELDS
908# endif
909#endif
910
911/** @def RT_COMPILER_WITH_80BIT_LONG_DOUBLE
912 * Macro that is defined if the compiler implements long double as the
913 * IEEE extended precision floating. */
914#if (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)) && !defined(RT_OS_WINDOWS)
915# define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
916#endif
917
918
919/** @def RT_EXCEPTIONS_ENABLED
920 * Defined when C++ exceptions are enabled.
921 */
922#if !defined(RT_EXCEPTIONS_ENABLED) \
923 && defined(__cplusplus) \
924 && ( (defined(_MSC_VER) && defined(_CPPUNWIND)) \
925 || (defined(__GNUC__) && defined(__EXCEPTIONS)))
926# define RT_EXCEPTIONS_ENABLED
927#endif
928
929/** @def RT_NO_THROW_PROTO
930 * How to express that a function doesn't throw C++ exceptions
931 * and the compiler can thus save itself the bother of trying
932 * to catch any of them. Put this between the closing parenthesis
933 * and the semicolon in function prototypes (and implementation if C++).
934 *
935 * @remarks May not work on C++ methods, mainly intented for C-style APIs.
936 *
937 * @remarks The use of the nothrow attribute with GCC is because old compilers
938 * (4.1.1, 32-bit) leaking the nothrow into global space or something
939 * when used with RTDECL or similar. Using this forces use to have two
940 * macros, as the nothrow attribute is not for the function definition.
941 */
942#ifdef RT_EXCEPTIONS_ENABLED
943# ifdef __GNUC__
944# define RT_NO_THROW_PROTO __attribute__((__nothrow__))
945# else
946# define RT_NO_THROW_PROTO throw()
947# endif
948#else
949# define RT_NO_THROW_PROTO
950#endif
951
952/** @def RT_NO_THROW_DEF
953 * The counter part to RT_NO_THROW_PROTO that is added to the function
954 * definition.
955 */
956#if defined(RT_EXCEPTIONS_ENABLED) && !defined(__GNUC__)
957# define RT_NO_THROW_DEF RT_NO_THROW_PROTO
958#else
959# define RT_NO_THROW_DEF
960#endif
961
962/** @def RT_THROW
963 * How to express that a method or function throws a type of exceptions. Some
964 * compilers does not want this kind of information and will warning about it.
965 *
966 * @param type The type exception.
967 *
968 * @remarks If the actual throwing is done from the header, enclose it by
969 * \#ifdef RT_EXCEPTIONS_ENABLED ... \#else ... \#endif so the header
970 * compiles cleanly without exceptions enabled.
971 *
972 * Do NOT use this for the actual throwing of exceptions!
973 */
974#ifdef RT_EXCEPTIONS_ENABLED
975# ifdef _MSC_VER
976# if _MSC_VER >= 1310
977# define RT_THROW(type)
978# else
979# define RT_THROW(type) throw(type)
980# endif
981# else
982# define RT_THROW(type) throw(type)
983# endif
984#else
985# define RT_THROW(type)
986#endif
987
988/** @def RT_IPRT_FORMAT_ATTR
989 * Identifies a function taking an IPRT format string.
990 * @param a_iFmt The index (1-based) of the format string argument.
991 * @param a_iArgs The index (1-based) of the first format argument, use 0 for
992 * va_list.
993 */
994#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)
995# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs) __attribute__((__iprt_format__(a_iFmt, a_iArgs)))
996#else
997# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)
998#endif
999
1000/** @def RT_IPRT_FORMAT_ATTR_MAYBE_NULL
1001 * Identifies a function taking an IPRT format string, NULL is allowed.
1002 * @param a_iFmt The index (1-based) of the format string argument.
1003 * @param a_iArgs The index (1-based) of the first format argument, use 0 for
1004 * va_list.
1005 */
1006#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)
1007# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs) __attribute__((__iprt_format_maybe_null__(a_iFmt, a_iArgs)))
1008#else
1009# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)
1010#endif
1011
1012
1013/** @def RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
1014 * Indicates that the "hidden" visibility attribute can be used (GCC) */
1015#if defined(__GNUC__)
1016# if __GNUC__ >= 4 && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
1017# define RT_GCC_SUPPORTS_VISIBILITY_HIDDEN
1018# endif
1019#endif
1020
1021/** @def RT_COMPILER_SUPPORTS_VA_ARGS
1022 * If the defined, the compiler supports the variadic macro feature (..., __VA_ARGS__). */
1023#if defined(_MSC_VER)
1024# if _MSC_VER >= 1600 /* Visual C++ v10.0 / 2010 */
1025# define RT_COMPILER_SUPPORTS_VA_ARGS
1026# endif
1027#elif defined(__GNUC__)
1028# if __GNUC__ >= 3 /* not entirely sure when this was added */
1029# define RT_COMPILER_SUPPORTS_VA_ARGS
1030# endif
1031#endif
1032
1033
1034
1035/** @def RTCALL
1036 * The standard calling convention for the Runtime interfaces.
1037 *
1038 * @remarks The regparm(0) in the X86/GNUC variant deals with -mregparm=x use in
1039 * the linux kernel and potentially elsewhere (3rd party).
1040 */
1041#if defined(_MSC_VER) || defined(__WATCOMC__)
1042# define RTCALL __cdecl
1043#elif defined(RT_OS_OS2)
1044# define RTCALL __cdecl
1045#elif defined(__GNUC__) && defined(RT_ARCH_X86)
1046# define RTCALL __attribute__((cdecl,regparm(0)))
1047#else
1048# define RTCALL
1049#endif
1050
1051/** @def DECLEXPORT
1052 * How to declare an exported function.
1053 * @param type The return type of the function declaration.
1054 */
1055#if defined(_MSC_VER) || defined(RT_OS_OS2)
1056# define DECLEXPORT(type) __declspec(dllexport) type
1057#elif defined(RT_USE_VISIBILITY_DEFAULT)
1058# define DECLEXPORT(type) __attribute__((visibility("default"))) type
1059#else
1060# define DECLEXPORT(type) type
1061#endif
1062
1063/** @def DECLIMPORT
1064 * How to declare an imported function.
1065 * @param type The return type of the function declaration.
1066 */
1067#if defined(_MSC_VER) || (defined(RT_OS_OS2) && !defined(__IBMC__) && !defined(__IBMCPP__))
1068# define DECLIMPORT(type) __declspec(dllimport) type
1069#else
1070# define DECLIMPORT(type) type
1071#endif
1072
1073/** @def DECLHIDDEN
1074 * How to declare a non-exported function or variable.
1075 * @param type The return type of the function or the data type of the variable.
1076 */
1077#if !defined(RT_GCC_SUPPORTS_VISIBILITY_HIDDEN) || defined(RT_NO_VISIBILITY_HIDDEN)
1078# define DECLHIDDEN(type) type
1079#else
1080# define DECLHIDDEN(type) __attribute__((visibility("hidden"))) type
1081#endif
1082
1083/** @def DECL_HIDDEN_CONST
1084 * Workaround for g++ warnings when applying the hidden attribute to a const
1085 * definition. Use DECLHIDDEN for the declaration.
1086 * @param a_Type The return type of the function or the data type of
1087 * the variable.
1088 */
1089#if defined(__cplusplus) && defined(__GNUC__)
1090# define DECL_HIDDEN_CONST(a_Type) a_Type
1091#else
1092# define DECL_HIDDEN_CONST(a_Type) DECLHIDDEN(a_Type)
1093#endif
1094
1095/** @def DECL_INVALID
1096 * How to declare a function not available for linking in the current context.
1097 * The purpose is to create compile or like time errors when used. This isn't
1098 * possible on all platforms.
1099 * @param type The return type of the function.
1100 */
1101#if defined(_MSC_VER)
1102# define DECL_INVALID(type) __declspec(dllimport) type __stdcall
1103#elif defined(__GNUC__) && defined(__cplusplus)
1104# define DECL_INVALID(type) extern "C++" type
1105#else
1106# define DECL_INVALID(type) type
1107#endif
1108
1109/** @def DECLASM
1110 * How to declare an internal assembly function.
1111 * @param type The return type of the function declaration.
1112 */
1113#ifdef __cplusplus
1114# define DECLASM(type) extern "C" type RTCALL
1115#else
1116# define DECLASM(type) type RTCALL
1117#endif
1118
1119/** @def DECLASMTYPE
1120 * How to declare an internal assembly function type.
1121 * @param type The return type of the function.
1122 */
1123#define DECLASMTYPE(type) type RTCALL
1124
1125/** @def DECLNORETURN
1126 * How to declare a function which does not return.
1127 * @note: This macro can be combined with other macros, for example
1128 * @code
1129 * EMR3DECL(DECLNORETURN(void)) foo(void);
1130 * @endcode
1131 */
1132#ifdef _MSC_VER
1133# define DECLNORETURN(type) __declspec(noreturn) type
1134#elif defined(__GNUC__)
1135# define DECLNORETURN(type) __attribute__((noreturn)) type
1136#else
1137# define DECLNORETURN(type) type
1138#endif
1139
1140/** @def DECLWEAK
1141 * How to declare a variable which is not necessarily resolved at
1142 * runtime.
1143 * @note: This macro can be combined with other macros, for example
1144 * @code
1145 * EMR3DECL(DECLWEAK(int)) foo;
1146 * @endcode
1147 */
1148#if defined(__GNUC__)
1149# define DECLWEAK(type) type __attribute__((weak))
1150#else
1151# define DECLWEAK(type) type
1152#endif
1153
1154/** @def DECLCALLBACK
1155 * How to declare an call back function type.
1156 * @param type The return type of the function declaration.
1157 */
1158#define DECLCALLBACK(type) type RTCALL
1159
1160/** @def DECLCALLBACKPTR
1161 * How to declare an call back function pointer.
1162 * @param type The return type of the function declaration.
1163 * @param name The name of the variable member.
1164 */
1165#if defined(__IBMC__) || defined(__IBMCPP__)
1166# define DECLCALLBACKPTR(type, name) type (* RTCALL name)
1167#else
1168# define DECLCALLBACKPTR(type, name) type (RTCALL * name)
1169#endif
1170
1171/** @def DECLCALLBACKMEMBER
1172 * How to declare an call back function pointer member.
1173 * @param type The return type of the function declaration.
1174 * @param name The name of the struct/union/class member.
1175 */
1176#if defined(__IBMC__) || defined(__IBMCPP__)
1177# define DECLCALLBACKMEMBER(type, name) type (* RTCALL name)
1178#else
1179# define DECLCALLBACKMEMBER(type, name) type (RTCALL * name)
1180#endif
1181
1182/** @def DECLR3CALLBACKMEMBER
1183 * How to declare an call back function pointer member - R3 Ptr.
1184 * @param type The return type of the function declaration.
1185 * @param name The name of the struct/union/class member.
1186 * @param args The argument list enclosed in parentheses.
1187 */
1188#ifdef IN_RING3
1189# define DECLR3CALLBACKMEMBER(type, name, args) DECLCALLBACKMEMBER(type, name) args
1190#else
1191# define DECLR3CALLBACKMEMBER(type, name, args) RTR3PTR name
1192#endif
1193
1194/** @def DECLRCCALLBACKMEMBER
1195 * How to declare an call back function pointer member - RC Ptr.
1196 * @param type The return type of the function declaration.
1197 * @param name The name of the struct/union/class member.
1198 * @param args The argument list enclosed in parentheses.
1199 */
1200#ifdef IN_RC
1201# define DECLRCCALLBACKMEMBER(type, name, args) DECLCALLBACKMEMBER(type, name) args
1202#else
1203# define DECLRCCALLBACKMEMBER(type, name, args) RTRCPTR name
1204#endif
1205
1206/** @def DECLR0CALLBACKMEMBER
1207 * How to declare an call back function pointer member - R0 Ptr.
1208 * @param type The return type of the function declaration.
1209 * @param name The name of the struct/union/class member.
1210 * @param args The argument list enclosed in parentheses.
1211 */
1212#ifdef IN_RING0
1213# define DECLR0CALLBACKMEMBER(type, name, args) DECLCALLBACKMEMBER(type, name) args
1214#else
1215# define DECLR0CALLBACKMEMBER(type, name, args) RTR0PTR name
1216#endif
1217
1218/** @def DECLINLINE
1219 * How to declare a function as inline.
1220 * @param type The return type of the function declaration.
1221 * @remarks Don't use this macro on C++ methods.
1222 */
1223#ifdef __GNUC__
1224# define DECLINLINE(type) static __inline__ type
1225#elif defined(__cplusplus)
1226# define DECLINLINE(type) inline type
1227#elif defined(_MSC_VER)
1228# define DECLINLINE(type) _inline type
1229#elif defined(__IBMC__)
1230# define DECLINLINE(type) _Inline type
1231#else
1232# define DECLINLINE(type) inline type
1233#endif
1234
1235
1236/** @def DECL_FORCE_INLINE
1237 * How to declare a function as inline and try convince the compiler to always
1238 * inline it regardless of optimization switches.
1239 * @param type The return type of the function declaration.
1240 * @remarks Use sparsely and with care. Don't use this macro on C++ methods.
1241 */
1242#ifdef __GNUC__
1243# define DECL_FORCE_INLINE(type) __attribute__((__always_inline__)) DECLINLINE(type)
1244#elif defined(_MSC_VER)
1245# define DECL_FORCE_INLINE(type) __forceinline type
1246#else
1247# define DECL_FORCE_INLINE(type) DECLINLINE(type)
1248#endif
1249
1250
1251/** @def DECL_NO_INLINE
1252 * How to declare a function telling the compiler not to inline it.
1253 * @param scope The function scope, static or RT_NOTHING.
1254 * @param type The return type of the function declaration.
1255 * @remarks Don't use this macro on C++ methods.
1256 */
1257#ifdef __GNUC__
1258# define DECL_NO_INLINE(scope,type) __attribute__((__noinline__)) scope type
1259#elif defined(_MSC_VER)
1260# define DECL_NO_INLINE(scope,type) __declspec(noinline) scope type
1261#else
1262# define DECL_NO_INLINE(scope,type) scope type
1263#endif
1264
1265
1266/** @def IN_RT_STATIC
1267 * Used to indicate whether we're linking against a static IPRT
1268 * or not. The IPRT symbols will be declared as hidden (if
1269 * supported). Note that this define has no effect without setting
1270 * IN_RT_R0, IN_RT_R3 or IN_RT_RC indicators are set first.
1271 */
1272
1273/** @def IN_RT_R0
1274 * Used to indicate whether we're inside the same link module as
1275 * the HC Ring-0 Runtime Library.
1276 */
1277/** @def RTR0DECL(type)
1278 * Runtime Library HC Ring-0 export or import declaration.
1279 * @param type The return type of the function declaration.
1280 */
1281#ifdef IN_RT_R0
1282# ifdef IN_RT_STATIC
1283# define RTR0DECL(type) DECLHIDDEN(type) RTCALL
1284# else
1285# define RTR0DECL(type) DECLEXPORT(type) RTCALL
1286# endif
1287#else
1288# define RTR0DECL(type) DECLIMPORT(type) RTCALL
1289#endif
1290
1291/** @def IN_RT_R3
1292 * Used to indicate whether we're inside the same link module as
1293 * the HC Ring-3 Runtime Library.
1294 */
1295/** @def RTR3DECL(type)
1296 * Runtime Library HC Ring-3 export or import declaration.
1297 * @param type The return type of the function declaration.
1298 */
1299#ifdef IN_RT_R3
1300# ifdef IN_RT_STATIC
1301# define RTR3DECL(type) DECLHIDDEN(type) RTCALL
1302# else
1303# define RTR3DECL(type) DECLEXPORT(type) RTCALL
1304# endif
1305#else
1306# define RTR3DECL(type) DECLIMPORT(type) RTCALL
1307#endif
1308
1309/** @def IN_RT_RC
1310 * Used to indicate whether we're inside the same link module as the raw-mode
1311 * context (RC) runtime library.
1312 */
1313/** @def RTRCDECL(type)
1314 * Runtime Library raw-mode context export or import declaration.
1315 * @param type The return type of the function declaration.
1316 */
1317#ifdef IN_RT_RC
1318# ifdef IN_RT_STATIC
1319# define RTRCDECL(type) DECLHIDDEN(type) RTCALL
1320# else
1321# define RTRCDECL(type) DECLEXPORT(type) RTCALL
1322# endif
1323#else
1324# define RTRCDECL(type) DECLIMPORT(type) RTCALL
1325#endif
1326
1327/** @def RTDECL(type)
1328 * Runtime Library export or import declaration.
1329 * Functions declared using this macro exists in all contexts.
1330 * @param type The return type of the function declaration.
1331 */
1332#if defined(IN_RT_R3) || defined(IN_RT_RC) || defined(IN_RT_R0)
1333# ifdef IN_RT_STATIC
1334# define RTDECL(type) DECLHIDDEN(type) RTCALL
1335# else
1336# define RTDECL(type) DECLEXPORT(type) RTCALL
1337# endif
1338#else
1339# define RTDECL(type) DECLIMPORT(type) RTCALL
1340#endif
1341
1342/** @def RTDATADECL(type)
1343 * Runtime Library export or import declaration.
1344 * Data declared using this macro exists in all contexts.
1345 * @param type The data type.
1346 */
1347/** @def RT_DECL_DATA_CONST(type)
1348 * Definition of a const variable. See DECL_HIDDEN_CONST.
1349 * @param type The const data type.
1350 */
1351#if defined(IN_RT_R3) || defined(IN_RT_RC) || defined(IN_RT_R0)
1352# ifdef IN_RT_STATIC
1353# define RTDATADECL(type) DECLHIDDEN(type)
1354# define RT_DECL_DATA_CONST(type) DECL_HIDDEN_CONST(type)
1355# else
1356# define RTDATADECL(type) DECLEXPORT(type)
1357# if defined(__cplusplus) && defined(__GNUC__)
1358# define RT_DECL_DATA_CONST(type) type
1359# else
1360# define RT_DECL_DATA_CONST(type) DECLEXPORT(type)
1361# endif
1362# endif
1363#else
1364# define RTDATADECL(type) DECLIMPORT(type)
1365# define RT_DECL_DATA_CONST(type) DECLIMPORT(type)
1366#endif
1367
1368/** @def RT_DECL_CLASS
1369 * Declares an class living in the runtime.
1370 */
1371#if defined(IN_RT_R3) || defined(IN_RT_RC) || defined(IN_RT_R0)
1372# ifdef IN_RT_STATIC
1373# define RT_DECL_CLASS
1374# else
1375# define RT_DECL_CLASS DECLEXPORT_CLASS
1376# endif
1377#else
1378# define RT_DECL_CLASS DECLIMPORT_CLASS
1379#endif
1380
1381
1382/** @def RT_NOCRT
1383 * Symbol name wrapper for the No-CRT bits.
1384 *
1385 * In order to coexist in the same process as other CRTs, we need to
1386 * decorate the symbols such that they don't conflict the ones in the
1387 * other CRTs. The result of such conflicts / duplicate symbols can
1388 * confuse the dynamic loader on Unix like systems.
1389 *
1390 * Define RT_WITHOUT_NOCRT_WRAPPERS to drop the wrapping.
1391 * Define RT_WITHOUT_NOCRT_WRAPPER_ALIASES to drop the aliases to the
1392 * wrapped names.
1393 */
1394/** @def RT_NOCRT_STR
1395 * Same as RT_NOCRT only it'll return a double quoted string of the result.
1396 */
1397#ifndef RT_WITHOUT_NOCRT_WRAPPERS
1398# define RT_NOCRT(name) nocrt_ ## name
1399# define RT_NOCRT_STR(name) "nocrt_" # name
1400#else
1401# define RT_NOCRT(name) name
1402# define RT_NOCRT_STR(name) #name
1403#endif
1404
1405
1406
1407/** @def RT_LIKELY
1408 * Give the compiler a hint that an expression is very likely to hold true.
1409 *
1410 * Some compilers support explicit branch prediction so that the CPU backend
1411 * can hint the processor and also so that code blocks can be reordered such
1412 * that the predicted path sees a more linear flow, thus improving cache
1413 * behaviour, etc.
1414 *
1415 * IPRT provides the macros RT_LIKELY() and RT_UNLIKELY() as a way to utilize
1416 * this compiler feature when present.
1417 *
1418 * A few notes about the usage:
1419 *
1420 * - Generally, order your code use RT_LIKELY() instead of RT_UNLIKELY().
1421 *
1422 * - Generally, use RT_UNLIKELY() with error condition checks (unless you
1423 * have some _strong_ reason to do otherwise, in which case document it),
1424 * and/or RT_LIKELY() with success condition checks, assuming you want
1425 * to optimize for the success path.
1426 *
1427 * - Other than that, if you don't know the likelihood of a test succeeding
1428 * from empirical or other 'hard' evidence, don't make predictions unless
1429 * you happen to be a Dirk Gently character.
1430 *
1431 * - These macros are meant to be used in places that get executed a lot. It
1432 * is wasteful to make predictions in code that is executed rarely (e.g.
1433 * at subsystem initialization time) as the basic block reordering that this
1434 * affects can often generate larger code.
1435 *
1436 * - Note that RT_SUCCESS() and RT_FAILURE() already makes use of RT_LIKELY()
1437 * and RT_UNLIKELY(). Should you wish for prediction free status checks,
1438 * use the RT_SUCCESS_NP() and RT_FAILURE_NP() macros instead.
1439 *
1440 *
1441 * @returns the boolean result of the expression.
1442 * @param expr The expression that's very likely to be true.
1443 * @see RT_UNLIKELY
1444 */
1445/** @def RT_UNLIKELY
1446 * Give the compiler a hint that an expression is highly unlikely to hold true.
1447 *
1448 * See the usage instructions give in the RT_LIKELY() docs.
1449 *
1450 * @returns the boolean result of the expression.
1451 * @param expr The expression that's very unlikely to be true.
1452 * @see RT_LIKELY
1453 *
1454 * @deprecated Please use RT_LIKELY() instead wherever possible! That gives us
1455 * a better chance of the windows compilers to generate favorable code
1456 * too. The belief is that the compiler will by default assume the
1457 * if-case is more likely than the else-case.
1458 */
1459#if defined(__GNUC__)
1460# if __GNUC__ >= 3 && !defined(FORTIFY_RUNNING)
1461# define RT_LIKELY(expr) __builtin_expect(!!(expr), 1)
1462# define RT_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
1463# else
1464# define RT_LIKELY(expr) (expr)
1465# define RT_UNLIKELY(expr) (expr)
1466# endif
1467#else
1468# define RT_LIKELY(expr) (expr)
1469# define RT_UNLIKELY(expr) (expr)
1470#endif
1471
1472/** @def RT_EXPAND_2
1473 * Helper for RT_EXPAND. */
1474#define RT_EXPAND_2(a_Expr) a_Expr
1475/** @def RT_EXPAND
1476 * Returns the expanded expression.
1477 * @param a_Expr The expression to expand. */
1478#define RT_EXPAND(a_Expr) RT_EXPAND_2(a_Expr)
1479
1480/** @def RT_STR
1481 * Returns the argument as a string constant.
1482 * @param str Argument to stringify. */
1483#define RT_STR(str) #str
1484/** @def RT_XSTR
1485 * Returns the expanded argument as a string.
1486 * @param str Argument to expand and stringify. */
1487#define RT_XSTR(str) RT_STR(str)
1488
1489/** @def RT_LSTR_2
1490 * Helper for RT_WSTR that gets the expanded @a str.
1491 * @param str String litteral to prefix with 'L'. */
1492#define RT_LSTR_2(str) L##str
1493/** @def RT_LSTR
1494 * Returns the expanded argument with a L string prefix.
1495 *
1496 * Intended for converting ASCII string \#defines into wide char string
1497 * litterals on Windows.
1498 *
1499 * @param str String litteral to . */
1500#define RT_LSTR(str) RT_LSTR_2(str)
1501
1502/** @def RT_UNPACK_CALL
1503 * Unpacks the an argument list inside an extra set of parenthesis and turns it
1504 * into a call to @a a_Fn.
1505 *
1506 * @param a_Fn Function/macro to call.
1507 * @param a_Args Parameter list in parenthesis.
1508 */
1509#define RT_UNPACK_CALL(a_Fn, a_Args) a_Fn a_Args
1510
1511#if defined(RT_COMPILER_SUPPORTS_VA_ARGS) || defined(DOXYGEN_RUNNING)
1512
1513/** @def RT_UNPACK_ARGS
1514 * Returns the arguments without parenthesis.
1515 *
1516 * @param ... Parameter list in parenthesis.
1517 * @remarks Requires RT_COMPILER_SUPPORTS_VA_ARGS.
1518 */
1519# define RT_UNPACK_ARGS(...) __VA_ARGS__
1520
1521/** @def RT_COUNT_VA_ARGS_HLP
1522 * Helper for RT_COUNT_VA_ARGS that picks out the argument count from
1523 * RT_COUNT_VA_ARGS_REV_SEQ. */
1524# define RT_COUNT_VA_ARGS_HLP( \
1525 c69, c68, c67, c66, c65, c64, c63, c62, c61, c60, \
1526 c59, c58, c57, c56, c55, c54, c53, c52, c51, c50, \
1527 c49, c48, c47, c46, c45, c44, c43, c42, c41, c40, \
1528 c39, c38, c37, c36, c35, c34, c33, c32, c31, c30, \
1529 c29, c28, c27, c26, c25, c24, c23, c22, c21, c20, \
1530 c19, c18, c17, c16, c15, c14, c13, c12, c11, c10, \
1531 c9, c8, c7, c6, c5, c4, c3, c2, c1, cArgs, ...) cArgs
1532/** Argument count sequence. */
1533# define RT_COUNT_VA_ARGS_REV_SEQ \
1534 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, \
1535 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \
1536 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \
1537 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \
1538 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
1539 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
1540 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
1541/** This is for zero arguments. At least Visual C++ requires it. */
1542# define RT_COUNT_VA_ARGS_PREFIX_RT_NOTHING RT_COUNT_VA_ARGS_REV_SEQ
1543/**
1544 * Counts the number of arguments given to the variadic macro.
1545 *
1546 * Max is 69.
1547 *
1548 * @returns Number of arguments in the ellipsis
1549 * @param ... Arguments to count.
1550 * @remarks Requires RT_COMPILER_SUPPORTS_VA_ARGS.
1551 */
1552# define RT_COUNT_VA_ARGS(...) \
1553 RT_UNPACK_CALL(RT_COUNT_VA_ARGS_HLP, (RT_COUNT_VA_ARGS_PREFIX_ ## __VA_ARGS__ ## RT_NOTHING, \
1554 RT_COUNT_VA_ARGS_REV_SEQ))
1555
1556#endif /* RT_COMPILER_SUPPORTS_VA_ARGS */
1557
1558
1559/** @def RT_CONCAT
1560 * Concatenate the expanded arguments without any extra spaces in between.
1561 *
1562 * @param a The first part.
1563 * @param b The second part.
1564 */
1565#define RT_CONCAT(a,b) RT_CONCAT_HLP(a,b)
1566/** RT_CONCAT helper, don't use. */
1567#define RT_CONCAT_HLP(a,b) a##b
1568
1569/** @def RT_CONCAT3
1570 * Concatenate the expanded arguments without any extra spaces in between.
1571 *
1572 * @param a The 1st part.
1573 * @param b The 2nd part.
1574 * @param c The 3rd part.
1575 */
1576#define RT_CONCAT3(a,b,c) RT_CONCAT3_HLP(a,b,c)
1577/** RT_CONCAT3 helper, don't use. */
1578#define RT_CONCAT3_HLP(a,b,c) a##b##c
1579
1580/** @def RT_CONCAT4
1581 * Concatenate the expanded arguments without any extra spaces in between.
1582 *
1583 * @param a The 1st part.
1584 * @param b The 2nd part.
1585 * @param c The 3rd part.
1586 * @param d The 4th part.
1587 */
1588#define RT_CONCAT4(a,b,c,d) RT_CONCAT4_HLP(a,b,c,d)
1589/** RT_CONCAT4 helper, don't use. */
1590#define RT_CONCAT4_HLP(a,b,c,d) a##b##c##d
1591
1592/** @def RT_CONCAT5
1593 * Concatenate the expanded arguments without any extra spaces in between.
1594 *
1595 * @param a The 1st part.
1596 * @param b The 2nd part.
1597 * @param c The 3rd part.
1598 * @param d The 4th part.
1599 * @param e The 5th part.
1600 */
1601#define RT_CONCAT5(a,b,c,d,e) RT_CONCAT5_HLP(a,b,c,d,e)
1602/** RT_CONCAT5 helper, don't use. */
1603#define RT_CONCAT5_HLP(a,b,c,d,e) a##b##c##d##e
1604
1605/** @def RT_CONCAT6
1606 * Concatenate the expanded arguments without any extra spaces in between.
1607 *
1608 * @param a The 1st part.
1609 * @param b The 2nd part.
1610 * @param c The 3rd part.
1611 * @param d The 4th part.
1612 * @param e The 5th part.
1613 * @param f The 6th part.
1614 */
1615#define RT_CONCAT6(a,b,c,d,e,f) RT_CONCAT6_HLP(a,b,c,d,e,f)
1616/** RT_CONCAT6 helper, don't use. */
1617#define RT_CONCAT6_HLP(a,b,c,d,e,f) a##b##c##d##e##f
1618
1619/**
1620 * String constant tuple - string constant, strlen(string constant).
1621 *
1622 * @param a_szConst String constant.
1623 * @sa RTSTRTUPLE
1624 */
1625#define RT_STR_TUPLE(a_szConst) a_szConst, (sizeof(a_szConst) - 1)
1626
1627
1628/**
1629 * Macro for using in switch statements that turns constants into strings.
1630 *
1631 * @param a_Const The constant (not string).
1632 */
1633#define RT_CASE_RET_STR(a_Const) case a_Const: return #a_Const
1634
1635
1636/** @def RT_BIT
1637 * Convert a bit number into an integer bitmask (unsigned).
1638 * @param bit The bit number.
1639 */
1640#define RT_BIT(bit) ( 1U << (bit) )
1641
1642/** @def RT_BIT_32
1643 * Convert a bit number into a 32-bit bitmask (unsigned).
1644 * @param bit The bit number.
1645 */
1646#define RT_BIT_32(bit) ( UINT32_C(1) << (bit) )
1647
1648/** @def RT_BIT_64
1649 * Convert a bit number into a 64-bit bitmask (unsigned).
1650 * @param bit The bit number.
1651 */
1652#define RT_BIT_64(bit) ( UINT64_C(1) << (bit) )
1653
1654
1655/** @def RT_BF_GET
1656 * Gets the value of a bit field in an integer value.
1657 *
1658 * This requires a couple of macros to be defined for the field:
1659 * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
1660 * - \<a_FieldNm\>_MASK: The field mask.
1661 *
1662 * @returns The bit field value.
1663 * @param a_uValue The integer value containing the field.
1664 * @param a_FieldNm The field name prefix for getting at the _SHIFT and
1665 * _MASK macros.
1666 * @sa #RT_BF_CLEAR, #RT_BF_SET, #RT_BF_MAKE, #RT_BF_ZMASK
1667 */
1668#define RT_BF_GET(a_uValue, a_FieldNm) ( ((a_uValue) >> RT_CONCAT(a_FieldNm,_SHIFT)) & RT_BF_ZMASK(a_FieldNm) )
1669
1670/** @def RT_BF_SET
1671 * Sets the given bit field in the integer value.
1672 *
1673 * This requires a couple of macros to be defined for the field:
1674 * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
1675 * - \<a_FieldNm\>_MASK: The field mask. Must have the same type as the
1676 * integer value!!
1677 *
1678 * @returns Integer value with bit field set to @a a_uFieldValue.
1679 * @param a_uValue The integer value containing the field.
1680 * @param a_FieldNm The field name prefix for getting at the _SHIFT and
1681 * _MASK macros.
1682 * @param a_uFieldValue The new field value.
1683 * @sa #RT_BF_GET, #RT_BF_CLEAR, #RT_BF_MAKE, #RT_BF_ZMASK
1684 */
1685#define RT_BF_SET(a_uValue, a_FieldNm, a_uFieldValue) ( RT_BF_CLEAR(a_uValue, a_FieldNm) | RT_BF_MAKE(a_FieldNm, a_uFieldValue) )
1686
1687/** @def RT_BF_CLEAR
1688 * Clears the given bit field in the integer value.
1689 *
1690 * This requires a couple of macros to be defined for the field:
1691 * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
1692 * - \<a_FieldNm\>_MASK: The field mask. Must have the same type as the
1693 * integer value!!
1694 *
1695 * @returns Integer value with bit field set to zero.
1696 * @param a_uValue The integer value containing the field.
1697 * @param a_FieldNm The field name prefix for getting at the _SHIFT and
1698 * _MASK macros.
1699 * @sa #RT_BF_GET, #RT_BF_SET, #RT_BF_MAKE, #RT_BF_ZMASK
1700 */
1701#define RT_BF_CLEAR(a_uValue, a_FieldNm) ( (a_uValue) & ~RT_CONCAT(a_FieldNm,_MASK) )
1702
1703/** @def RT_BF_MAKE
1704 * Shifts and masks a bit field value into position in the integer value.
1705 *
1706 * This requires a couple of macros to be defined for the field:
1707 * - \<a_FieldNm\>_SHIFT: The shift count to get to the field.
1708 * - \<a_FieldNm\>_MASK: The field mask.
1709 *
1710 * @param a_FieldNm The field name prefix for getting at the _SHIFT and
1711 * _MASK macros.
1712 * @param a_uFieldValue The field value that should be masked and shifted
1713 * into position.
1714 * @sa #RT_BF_GET, #RT_BF_SET, #RT_BF_CLEAR, #RT_BF_ZMASK
1715 */
1716#define RT_BF_MAKE(a_FieldNm, a_uFieldValue) ( ((a_uFieldValue) & RT_BF_ZMASK(a_FieldNm) ) << RT_CONCAT(a_FieldNm,_SHIFT) )
1717
1718/** @def RT_BF_ZMASK
1719 * Helper for getting the field mask shifted to bit position zero.
1720 *
1721 * @param a_FieldNm The field name prefix for getting at the _SHIFT and
1722 * _MASK macros.
1723 * @sa #RT_BF_GET, #RT_BF_SET, #RT_BF_CLEAR, #RT_BF_MAKE
1724 */
1725#define RT_BF_ZMASK(a_FieldNm) ( RT_CONCAT(a_FieldNm,_MASK) >> RT_CONCAT(a_FieldNm,_SHIFT) )
1726
1727/** Bit field compile time check helper
1728 * @internal */
1729#define RT_BF_CHECK_DO_XOR_MASK(a_uLeft, a_RightPrefix, a_FieldNm) ((a_uLeft) ^ RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK))
1730/** Bit field compile time check helper
1731 * @internal */
1732#define RT_BF_CHECK_DO_OR_MASK(a_uLeft, a_RightPrefix, a_FieldNm) ((a_uLeft) | RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK))
1733/** Bit field compile time check helper
1734 * @internal */
1735#define RT_BF_CHECK_DO_1ST_MASK_BIT(a_uLeft, a_RightPrefix, a_FieldNm) \
1736 ((a_uLeft) && ( (RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK) >> RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) & 1U ) )
1737/** Used to check that a bit field mask does not start too early.
1738 * @internal */
1739#define RT_BF_CHECK_DO_MASK_START(a_uLeft, a_RightPrefix, a_FieldNm) \
1740 ( (a_uLeft) \
1741 && ( RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT) == 0 \
1742 || ( ( ( ((RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK) >> RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) & 1U) \
1743 << RT_CONCAT3(a_RightPrefix, a_FieldNm, _SHIFT)) /* => single bit mask, correct type */ \
1744 - 1U) /* => mask of all bits below the field */ \
1745 & RT_CONCAT3(a_RightPrefix, a_FieldNm, _MASK)) == 0 ) )
1746/** @name Bit field compile time check recursion workers.
1747 * @internal
1748 * @{ */
1749#define RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix, f1) \
1750 a_DoThis(a_uLeft, a_RightPrefix, f1)
1751#define RT_BF_CHECK_DO_2(a_DoThis, a_uLeft, a_RightPrefix, f1, f2) \
1752 RT_BF_CHECK_DO_1(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2)
1753#define RT_BF_CHECK_DO_3(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3) \
1754 RT_BF_CHECK_DO_2(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3)
1755#define RT_BF_CHECK_DO_4(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4) \
1756 RT_BF_CHECK_DO_3(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4)
1757#define RT_BF_CHECK_DO_5(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5) \
1758 RT_BF_CHECK_DO_4(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5)
1759#define RT_BF_CHECK_DO_6(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6) \
1760 RT_BF_CHECK_DO_5(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6)
1761#define RT_BF_CHECK_DO_7(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7) \
1762 RT_BF_CHECK_DO_6(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7)
1763#define RT_BF_CHECK_DO_8(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8) \
1764 RT_BF_CHECK_DO_7(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8)
1765#define RT_BF_CHECK_DO_9(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9) \
1766 RT_BF_CHECK_DO_8(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9)
1767#define RT_BF_CHECK_DO_10(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10) \
1768 RT_BF_CHECK_DO_9(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10)
1769#define RT_BF_CHECK_DO_11(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11) \
1770 RT_BF_CHECK_DO_10(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11)
1771#define RT_BF_CHECK_DO_12(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12) \
1772 RT_BF_CHECK_DO_11(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12)
1773#define RT_BF_CHECK_DO_13(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13) \
1774 RT_BF_CHECK_DO_12(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13)
1775#define RT_BF_CHECK_DO_14(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14) \
1776 RT_BF_CHECK_DO_13(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14)
1777#define RT_BF_CHECK_DO_15(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15) \
1778 RT_BF_CHECK_DO_14(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15)
1779#define RT_BF_CHECK_DO_16(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16) \
1780 RT_BF_CHECK_DO_15(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16)
1781#define RT_BF_CHECK_DO_17(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17) \
1782 RT_BF_CHECK_DO_16(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17)
1783#define RT_BF_CHECK_DO_18(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18) \
1784 RT_BF_CHECK_DO_17(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18)
1785#define RT_BF_CHECK_DO_19(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19) \
1786 RT_BF_CHECK_DO_18(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19)
1787#define RT_BF_CHECK_DO_20(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20) \
1788 RT_BF_CHECK_DO_19(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20)
1789#define RT_BF_CHECK_DO_21(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21) \
1790 RT_BF_CHECK_DO_20(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21)
1791#define RT_BF_CHECK_DO_22(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22) \
1792 RT_BF_CHECK_DO_21(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22)
1793#define RT_BF_CHECK_DO_23(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23) \
1794 RT_BF_CHECK_DO_22(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23)
1795#define RT_BF_CHECK_DO_24(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24) \
1796 RT_BF_CHECK_DO_23(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24)
1797#define RT_BF_CHECK_DO_25(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25) \
1798 RT_BF_CHECK_DO_24(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25)
1799#define RT_BF_CHECK_DO_26(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26) \
1800 RT_BF_CHECK_DO_25(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26)
1801#define RT_BF_CHECK_DO_27(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27) \
1802 RT_BF_CHECK_DO_26(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27)
1803#define RT_BF_CHECK_DO_28(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28) \
1804 RT_BF_CHECK_DO_27(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28)
1805#define RT_BF_CHECK_DO_29(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29) \
1806 RT_BF_CHECK_DO_28(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29)
1807#define RT_BF_CHECK_DO_30(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30) \
1808 RT_BF_CHECK_DO_29(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30)
1809#define RT_BF_CHECK_DO_31(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31) \
1810 RT_BF_CHECK_DO_30(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31)
1811#define RT_BF_CHECK_DO_32(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32) \
1812 RT_BF_CHECK_DO_31(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32)
1813#define RT_BF_CHECK_DO_33(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33) \
1814 RT_BF_CHECK_DO_32(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33)
1815#define RT_BF_CHECK_DO_34(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34) \
1816 RT_BF_CHECK_DO_33(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34)
1817#define RT_BF_CHECK_DO_35(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35) \
1818 RT_BF_CHECK_DO_34(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35)
1819#define RT_BF_CHECK_DO_36(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36) \
1820 RT_BF_CHECK_DO_35(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36)
1821#define RT_BF_CHECK_DO_37(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37) \
1822 RT_BF_CHECK_DO_36(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37)
1823#define RT_BF_CHECK_DO_38(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38) \
1824 RT_BF_CHECK_DO_37(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38)
1825#define RT_BF_CHECK_DO_39(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39) \
1826 RT_BF_CHECK_DO_38(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39)
1827#define RT_BF_CHECK_DO_40(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40) \
1828 RT_BF_CHECK_DO_39(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40)
1829#define RT_BF_CHECK_DO_41(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41) \
1830 RT_BF_CHECK_DO_40(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41)
1831#define RT_BF_CHECK_DO_42(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42) \
1832 RT_BF_CHECK_DO_41(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42)
1833#define RT_BF_CHECK_DO_43(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43) \
1834 RT_BF_CHECK_DO_42(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43)
1835#define RT_BF_CHECK_DO_44(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44) \
1836 RT_BF_CHECK_DO_43(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44)
1837#define RT_BF_CHECK_DO_45(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45) \
1838 RT_BF_CHECK_DO_44(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45)
1839#define RT_BF_CHECK_DO_46(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46) \
1840 RT_BF_CHECK_DO_45(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46)
1841#define RT_BF_CHECK_DO_47(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47) \
1842 RT_BF_CHECK_DO_46(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47)
1843#define RT_BF_CHECK_DO_48(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48) \
1844 RT_BF_CHECK_DO_47(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48)
1845#define RT_BF_CHECK_DO_49(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49) \
1846 RT_BF_CHECK_DO_48(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49)
1847#define RT_BF_CHECK_DO_50(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50) \
1848 RT_BF_CHECK_DO_49(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50)
1849#define RT_BF_CHECK_DO_51(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51) \
1850 RT_BF_CHECK_DO_40(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51)
1851#define RT_BF_CHECK_DO_52(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52) \
1852 RT_BF_CHECK_DO_51(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52)
1853#define RT_BF_CHECK_DO_53(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53) \
1854 RT_BF_CHECK_DO_52(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53)
1855#define RT_BF_CHECK_DO_54(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54) \
1856 RT_BF_CHECK_DO_53(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54)
1857#define RT_BF_CHECK_DO_55(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55) \
1858 RT_BF_CHECK_DO_54(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55)
1859#define RT_BF_CHECK_DO_56(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56) \
1860 RT_BF_CHECK_DO_55(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56)
1861#define RT_BF_CHECK_DO_57(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57) \
1862 RT_BF_CHECK_DO_56(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57)
1863#define RT_BF_CHECK_DO_58(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58) \
1864 RT_BF_CHECK_DO_57(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58)
1865#define RT_BF_CHECK_DO_59(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59) \
1866 RT_BF_CHECK_DO_58(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59)
1867#define RT_BF_CHECK_DO_60(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60) \
1868 RT_BF_CHECK_DO_59(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60)
1869#define RT_BF_CHECK_DO_61(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61) \
1870 RT_BF_CHECK_DO_60(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61)
1871#define RT_BF_CHECK_DO_62(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62) \
1872 RT_BF_CHECK_DO_61(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62)
1873#define RT_BF_CHECK_DO_63(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63) \
1874 RT_BF_CHECK_DO_62(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63)
1875#define RT_BF_CHECK_DO_64(a_DoThis, a_uLeft, a_RightPrefix, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63, f64) \
1876 RT_BF_CHECK_DO_63(a_DoThis, RT_BF_CHECK_DO_1(a_DoThis, a_uLeft, a_RightPrefix,f1), a_RightPrefix, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41, f42, f43, f44, f45, f46, f47, f48, f49, f50, f51, f52, f53, f54, f55, f56, f57, f58, f59, f60, f61, f62, f63, f64)
1877/** @} */
1878
1879/** @def RT_BF_ASSERT_COMPILE_CHECKS
1880 * Emits a series of AssertCompile statements checking that the bit-field
1881 * declarations doesn't overlap, has holes, and generally makes some sense.
1882 *
1883 * This requires variadic macros because its too much to type otherwise.
1884 */
1885#if defined(RT_COMPILER_SUPPORTS_VA_ARGS) || defined(DOXYGEN_RUNNING)
1886# define RT_BF_ASSERT_COMPILE_CHECKS(a_Prefix, a_uZero, a_uCovered, a_Fields) \
1887 AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_OR_MASK, a_uZero, a_Prefix, RT_UNPACK_ARGS a_Fields ) == a_uCovered); \
1888 AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_XOR_MASK, a_uCovered, a_Prefix, RT_UNPACK_ARGS a_Fields ) == 0); \
1889 AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_1ST_MASK_BIT, true, a_Prefix, RT_UNPACK_ARGS a_Fields ) == true); \
1890 AssertCompile(RT_BF_CHECK_DO_N(RT_BF_CHECK_DO_MASK_START, true, a_Prefix, RT_UNPACK_ARGS a_Fields ) == true)
1891/** Bit field compile time check helper
1892 * @internal */
1893# define RT_BF_CHECK_DO_N(a_DoThis, a_uLeft, a_RightPrefix, ...) \
1894 RT_UNPACK_CALL(RT_CONCAT(RT_BF_CHECK_DO_, RT_EXPAND(RT_COUNT_VA_ARGS(__VA_ARGS__))), (a_DoThis, a_uLeft, a_RightPrefix, __VA_ARGS__))
1895#else
1896# define RT_BF_ASSERT_COMPILE_CHECKS(a_Prefix, a_uZero, a_uCovered, a_Fields) AssertCompile(true)
1897#endif
1898
1899
1900/** @def RT_ALIGN
1901 * Align macro.
1902 * @param u Value to align.
1903 * @param uAlignment The alignment. Power of two!
1904 *
1905 * @remark Be extremely careful when using this macro with type which sizeof != sizeof int.
1906 * When possible use any of the other RT_ALIGN_* macros. And when that's not
1907 * possible, make 101% sure that uAlignment is specified with a right sized type.
1908 *
1909 * Specifying an unsigned 32-bit alignment constant with a 64-bit value will give
1910 * you a 32-bit return value!
1911 *
1912 * In short: Don't use this macro. Use RT_ALIGN_T() instead.
1913 */
1914#define RT_ALIGN(u, uAlignment) ( ((u) + ((uAlignment) - 1)) & ~((uAlignment) - 1) )
1915
1916/** @def RT_ALIGN_T
1917 * Align macro.
1918 * @param u Value to align.
1919 * @param uAlignment The alignment. Power of two!
1920 * @param type Integer type to use while aligning.
1921 * @remark This macro is the preferred alignment macro, it doesn't have any of the pitfalls RT_ALIGN has.
1922 */
1923#define RT_ALIGN_T(u, uAlignment, type) ( ((type)(u) + ((uAlignment) - 1)) & ~(type)((uAlignment) - 1) )
1924
1925/** @def RT_ALIGN_32
1926 * Align macro for a 32-bit value.
1927 * @param u32 Value to align.
1928 * @param uAlignment The alignment. Power of two!
1929 */
1930#define RT_ALIGN_32(u32, uAlignment) RT_ALIGN_T(u32, uAlignment, uint32_t)
1931
1932/** @def RT_ALIGN_64
1933 * Align macro for a 64-bit value.
1934 * @param u64 Value to align.
1935 * @param uAlignment The alignment. Power of two!
1936 */
1937#define RT_ALIGN_64(u64, uAlignment) RT_ALIGN_T(u64, uAlignment, uint64_t)
1938
1939/** @def RT_ALIGN_Z
1940 * Align macro for size_t.
1941 * @param cb Value to align.
1942 * @param uAlignment The alignment. Power of two!
1943 */
1944#define RT_ALIGN_Z(cb, uAlignment) RT_ALIGN_T(cb, uAlignment, size_t)
1945
1946/** @def RT_ALIGN_P
1947 * Align macro for pointers.
1948 * @param pv Value to align.
1949 * @param uAlignment The alignment. Power of two!
1950 */
1951#define RT_ALIGN_P(pv, uAlignment) RT_ALIGN_PT(pv, uAlignment, void *)
1952
1953/** @def RT_ALIGN_PT
1954 * Align macro for pointers with type cast.
1955 * @param u Value to align.
1956 * @param uAlignment The alignment. Power of two!
1957 * @param CastType The type to cast the result to.
1958 */
1959#define RT_ALIGN_PT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, uintptr_t) )
1960
1961/** @def RT_ALIGN_R3PT
1962 * Align macro for ring-3 pointers with type cast.
1963 * @param u Value to align.
1964 * @param uAlignment The alignment. Power of two!
1965 * @param CastType The type to cast the result to.
1966 */
1967#define RT_ALIGN_R3PT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, RTR3UINTPTR) )
1968
1969/** @def RT_ALIGN_R0PT
1970 * Align macro for ring-0 pointers with type cast.
1971 * @param u Value to align.
1972 * @param uAlignment The alignment. Power of two!
1973 * @param CastType The type to cast the result to.
1974 */
1975#define RT_ALIGN_R0PT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, RTR0UINTPTR) )
1976
1977/** @def RT_ALIGN_GCPT
1978 * Align macro for GC pointers with type cast.
1979 * @param u Value to align.
1980 * @param uAlignment The alignment. Power of two!
1981 * @param CastType The type to cast the result to.
1982 */
1983#define RT_ALIGN_GCPT(u, uAlignment, CastType) ( (CastType)RT_ALIGN_T(u, uAlignment, RTGCUINTPTR) )
1984
1985
1986/** @def RT_OFFSETOF
1987 * Our own special offsetof() variant, returns a signed result.
1988 *
1989 * This differs from the usual offsetof() in that it's not relying on builtin
1990 * compiler stuff and thus can use variables in arrays the structure may
1991 * contain. This is useful to determine the sizes of structures ending
1992 * with a variable length field. For gcc >= 4.4 see @bugref{7775}.
1993 *
1994 * @returns offset into the structure of the specified member. signed.
1995 * @param type Structure type.
1996 * @param member Member.
1997 */
1998#if defined(__GNUC__) && defined(__cplusplus) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
1999# define RT_OFFSETOF(type, member) ( (int)(uintptr_t)&( ((type *)(void *)0x1000)->member) - 0x1000 )
2000#else
2001# define RT_OFFSETOF(type, member) ( (int)(uintptr_t)&( ((type *)(void *)0)->member) )
2002#endif
2003
2004/** @def RT_UOFFSETOF
2005 * Our own special offsetof() variant, returns an unsigned result.
2006 *
2007 * This differs from the usual offsetof() in that it's not relying on builtin
2008 * compiler stuff and thus can use variables in arrays the structure may
2009 * contain. This is useful to determine the sizes of structures ending
2010 * with a variable length field. For gcc >= 4.4 see @bugref{7775}.
2011 *
2012 * @returns offset into the structure of the specified member. unsigned.
2013 * @param type Structure type.
2014 * @param member Member.
2015 */
2016#if defined(__GNUC__) && defined(__cplusplus) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
2017# define RT_UOFFSETOF(type, member) ( (uintptr_t)&( ((type *)(void *)0x1000)->member) - 0x1000 )
2018#else
2019# define RT_UOFFSETOF(type, member) ( (uintptr_t)&( ((type *)(void *)0)->member) )
2020#endif
2021
2022/** @def RT_OFFSETOF_ADD
2023 * RT_OFFSETOF with an addend.
2024 *
2025 * @returns offset into the structure of the specified member. signed.
2026 * @param type Structure type.
2027 * @param member Member.
2028 * @param addend The addend to add to the offset.
2029 */
2030#define RT_OFFSETOF_ADD(type, member, addend) ( (int)RT_UOFFSETOF_ADD(type, member, addend) )
2031
2032/** @def RT_UOFFSETOF_ADD
2033 * RT_UOFFSETOF with an addend.
2034 *
2035 * @returns offset into the structure of the specified member. signed.
2036 * @param type Structure type.
2037 * @param member Member.
2038 * @param addend The addend to add to the offset.
2039 */
2040#define RT_UOFFSETOF_ADD(type, member, addend) ( (uintptr_t)&( ((type *)(void *)(uintptr_t)(addend))->member) )
2041
2042/** @def RT_SIZEOFMEMB
2043 * Get the size of a structure member.
2044 *
2045 * @returns size of the structure member.
2046 * @param type Structure type.
2047 * @param member Member.
2048 */
2049#define RT_SIZEOFMEMB(type, member) ( sizeof(((type *)(void *)0)->member) )
2050
2051/** @def RT_FROM_MEMBER
2052 * Convert a pointer to a structure member into a pointer to the structure.
2053 *
2054 * @returns pointer to the structure.
2055 * @param pMem Pointer to the member.
2056 * @param Type Structure type.
2057 * @param Member Member name.
2058 */
2059#define RT_FROM_MEMBER(pMem, Type, Member) ( (Type *) ((uint8_t *)(void *)(pMem) - RT_UOFFSETOF(Type, Member)) )
2060
2061/** @def RT_FROM_CPP_MEMBER
2062 * Same as RT_FROM_MEMBER except it avoids the annoying g++ warnings about
2063 * invalid access to non-static data member of NULL object.
2064 *
2065 * @returns pointer to the structure.
2066 * @param pMem Pointer to the member.
2067 * @param Type Structure type.
2068 * @param Member Member name.
2069 *
2070 * @remarks Using the __builtin_offsetof does not shut up the compiler.
2071 */
2072#if defined(__GNUC__) && defined(__cplusplus)
2073# define RT_FROM_CPP_MEMBER(pMem, Type, Member) \
2074 ( (Type *) ((uintptr_t)(pMem) - (uintptr_t)&((Type *)0x1000)->Member + 0x1000U) )
2075#else
2076# define RT_FROM_CPP_MEMBER(pMem, Type, Member) RT_FROM_MEMBER(pMem, Type, Member)
2077#endif
2078
2079/** @def RT_ELEMENTS
2080 * Calculates the number of elements in a statically sized array.
2081 * @returns Element count.
2082 * @param aArray Array in question.
2083 */
2084#define RT_ELEMENTS(aArray) ( sizeof(aArray) / sizeof((aArray)[0]) )
2085
2086/**
2087 * Checks if the value is a power of two.
2088 *
2089 * @returns true if power of two, false if not.
2090 * @param uVal The value to test.
2091 * @remarks 0 is a power of two.
2092 * @see VERR_NOT_POWER_OF_TWO
2093 */
2094#define RT_IS_POWER_OF_TWO(uVal) ( ((uVal) & ((uVal) - 1)) == 0)
2095
2096#ifdef RT_OS_OS2
2097/* Undefine RT_MAX since there is an unfortunate clash with the max
2098 resource type define in os2.h. */
2099# undef RT_MAX
2100#endif
2101
2102/** @def RT_MAX
2103 * Finds the maximum value.
2104 * @returns The higher of the two.
2105 * @param Value1 Value 1
2106 * @param Value2 Value 2
2107 */
2108#define RT_MAX(Value1, Value2) ( (Value1) >= (Value2) ? (Value1) : (Value2) )
2109
2110/** @def RT_MIN
2111 * Finds the minimum value.
2112 * @returns The lower of the two.
2113 * @param Value1 Value 1
2114 * @param Value2 Value 2
2115 */
2116#define RT_MIN(Value1, Value2) ( (Value1) <= (Value2) ? (Value1) : (Value2) )
2117
2118/** @def RT_CLAMP
2119 * Clamps the value to minimum and maximum values.
2120 * @returns The clamped value.
2121 * @param Value The value to check.
2122 * @param Min Minimum value.
2123 * @param Max Maximum value.
2124 */
2125#define RT_CLAMP(Value, Min, Max) ( (Value) > (Max) ? (Max) : (Value) < (Min) ? (Min) : (Value) )
2126
2127/** @def RT_ABS
2128 * Get the absolute (non-negative) value.
2129 * @returns The absolute value of Value.
2130 * @param Value The value.
2131 */
2132#define RT_ABS(Value) ( (Value) >= 0 ? (Value) : -(Value) )
2133
2134/** @def RT_BOOL
2135 * Turn non-zero/zero into true/false
2136 * @returns The resulting boolean value.
2137 * @param Value The value.
2138 */
2139#define RT_BOOL(Value) ( !!(Value) )
2140
2141/** @def RT_LO_U8
2142 * Gets the low uint8_t of a uint16_t or something equivalent. */
2143#ifdef __GNUC__
2144# define RT_LO_U8(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)(a); })
2145#else
2146# define RT_LO_U8(a) ( (uint8_t)(a) )
2147#endif
2148/** @def RT_HI_U8
2149 * Gets the high uint8_t of a uint16_t or something equivalent. */
2150#ifdef __GNUC__
2151# define RT_HI_U8(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint16_t)); (uint8_t)((a) >> 8); })
2152#else
2153# define RT_HI_U8(a) ( (uint8_t)((a) >> 8) )
2154#endif
2155
2156/** @def RT_LO_U16
2157 * Gets the low uint16_t of a uint32_t or something equivalent. */
2158#ifdef __GNUC__
2159# define RT_LO_U16(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint32_t)); (uint16_t)(a); })
2160#else
2161# define RT_LO_U16(a) ( (uint16_t)(a) )
2162#endif
2163/** @def RT_HI_U16
2164 * Gets the high uint16_t of a uint32_t or something equivalent. */
2165#ifdef __GNUC__
2166# define RT_HI_U16(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint32_t)); (uint16_t)((a) >> 16); })
2167#else
2168# define RT_HI_U16(a) ( (uint16_t)((a) >> 16) )
2169#endif
2170
2171/** @def RT_LO_U32
2172 * Gets the low uint32_t of a uint64_t or something equivalent. */
2173#ifdef __GNUC__
2174# define RT_LO_U32(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)(a); })
2175#else
2176# define RT_LO_U32(a) ( (uint32_t)(a) )
2177#endif
2178/** @def RT_HI_U32
2179 * Gets the high uint32_t of a uint64_t or something equivalent. */
2180#ifdef __GNUC__
2181# define RT_HI_U32(a) __extension__ ({ AssertCompile(sizeof((a)) == sizeof(uint64_t)); (uint32_t)((a) >> 32); })
2182#else
2183# define RT_HI_U32(a) ( (uint32_t)((a) >> 32) )
2184#endif
2185
2186/** @def RT_BYTE1
2187 * Gets the first byte of something. */
2188#define RT_BYTE1(a) ( (a) & 0xff )
2189/** @def RT_BYTE2
2190 * Gets the second byte of something. */
2191#define RT_BYTE2(a) ( ((a) >> 8) & 0xff )
2192/** @def RT_BYTE3
2193 * Gets the second byte of something. */
2194#define RT_BYTE3(a) ( ((a) >> 16) & 0xff )
2195/** @def RT_BYTE4
2196 * Gets the fourth byte of something. */
2197#define RT_BYTE4(a) ( ((a) >> 24) & 0xff )
2198/** @def RT_BYTE5
2199 * Gets the fifth byte of something. */
2200#define RT_BYTE5(a) ( ((a) >> 32) & 0xff )
2201/** @def RT_BYTE6
2202 * Gets the sixth byte of something. */
2203#define RT_BYTE6(a) ( ((a) >> 40) & 0xff )
2204/** @def RT_BYTE7
2205 * Gets the seventh byte of something. */
2206#define RT_BYTE7(a) ( ((a) >> 48) & 0xff )
2207/** @def RT_BYTE8
2208 * Gets the eight byte of something. */
2209#define RT_BYTE8(a) ( ((a) >> 56) & 0xff )
2210
2211
2212/** @def RT_LODWORD
2213 * Gets the low dword (=uint32_t) of something.
2214 * @deprecated Use RT_LO_U32. */
2215#define RT_LODWORD(a) ( (uint32_t)(a) )
2216/** @def RT_HIDWORD
2217 * Gets the high dword (=uint32_t) of a 64-bit of something.
2218 * @deprecated Use RT_HI_U32. */
2219#define RT_HIDWORD(a) ( (uint32_t)((a) >> 32) )
2220
2221/** @def RT_LOWORD
2222 * Gets the low word (=uint16_t) of something.
2223 * @deprecated Use RT_LO_U16. */
2224#define RT_LOWORD(a) ( (a) & 0xffff )
2225/** @def RT_HIWORD
2226 * Gets the high word (=uint16_t) of a 32-bit something.
2227 * @deprecated Use RT_HI_U16. */
2228#define RT_HIWORD(a) ( (a) >> 16 )
2229
2230/** @def RT_LOBYTE
2231 * Gets the low byte of something.
2232 * @deprecated Use RT_LO_U8. */
2233#define RT_LOBYTE(a) ( (a) & 0xff )
2234/** @def RT_HIBYTE
2235 * Gets the high byte of a 16-bit something.
2236 * @deprecated Use RT_HI_U8. */
2237#define RT_HIBYTE(a) ( (a) >> 8 )
2238
2239
2240/** @def RT_MAKE_U64
2241 * Constructs a uint64_t value from two uint32_t values.
2242 */
2243#define RT_MAKE_U64(Lo, Hi) ( (uint64_t)((uint32_t)(Hi)) << 32 | (uint32_t)(Lo) )
2244
2245/** @def RT_MAKE_U64_FROM_U16
2246 * Constructs a uint64_t value from four uint16_t values.
2247 */
2248#define RT_MAKE_U64_FROM_U16(w0, w1, w2, w3) \
2249 ((uint64_t)( (uint64_t)((uint16_t)(w3)) << 48 \
2250 | (uint64_t)((uint16_t)(w2)) << 32 \
2251 | (uint32_t)((uint16_t)(w1)) << 16 \
2252 | (uint16_t)(w0) ))
2253
2254/** @def RT_MAKE_U64_FROM_U8
2255 * Constructs a uint64_t value from eight uint8_t values.
2256 */
2257#define RT_MAKE_U64_FROM_U8(b0, b1, b2, b3, b4, b5, b6, b7) \
2258 ((uint64_t)( (uint64_t)((uint8_t)(b7)) << 56 \
2259 | (uint64_t)((uint8_t)(b6)) << 48 \
2260 | (uint64_t)((uint8_t)(b5)) << 40 \
2261 | (uint64_t)((uint8_t)(b4)) << 32 \
2262 | (uint32_t)((uint8_t)(b3)) << 24 \
2263 | (uint32_t)((uint8_t)(b2)) << 16 \
2264 | (uint16_t)((uint8_t)(b1)) << 8 \
2265 | (uint8_t)(b0) ))
2266
2267/** @def RT_MAKE_U32
2268 * Constructs a uint32_t value from two uint16_t values.
2269 */
2270#define RT_MAKE_U32(Lo, Hi) \
2271 ((uint32_t)( (uint32_t)((uint16_t)(Hi)) << 16 \
2272 | (uint16_t)(Lo) ))
2273
2274/** @def RT_MAKE_U32_FROM_U8
2275 * Constructs a uint32_t value from four uint8_t values.
2276 */
2277#define RT_MAKE_U32_FROM_U8(b0, b1, b2, b3) \
2278 ((uint32_t)( (uint32_t)((uint8_t)(b3)) << 24 \
2279 | (uint32_t)((uint8_t)(b2)) << 16 \
2280 | (uint16_t)((uint8_t)(b1)) << 8 \
2281 | (uint8_t)(b0) ))
2282
2283/** @def RT_MAKE_U16
2284 * Constructs a uint16_t value from two uint8_t values.
2285 */
2286#define RT_MAKE_U16(Lo, Hi) \
2287 ((uint16_t)( (uint16_t)((uint8_t)(Hi)) << 8 \
2288 | (uint8_t)(Lo) ))
2289
2290
2291/** @def RT_BSWAP_U64
2292 * Reverses the byte order of an uint64_t value. */
2293#if 0
2294# define RT_BSWAP_U64(u64) RT_BSWAP_U64_C(u64)
2295#elif defined(__GNUC__)
2296# define RT_BSWAP_U64(u64) (__builtin_constant_p((u64)) \
2297 ? RT_BSWAP_U64_C(u64) : ASMByteSwapU64(u64))
2298#else
2299# define RT_BSWAP_U64(u64) ASMByteSwapU64(u64)
2300#endif
2301
2302/** @def RT_BSWAP_U32
2303 * Reverses the byte order of an uint32_t value. */
2304#if 0
2305# define RT_BSWAP_U32(u32) RT_BSWAP_U32_C(u32)
2306#elif defined(__GNUC__)
2307# define RT_BSWAP_U32(u32) (__builtin_constant_p((u32)) \
2308 ? RT_BSWAP_U32_C(u32) : ASMByteSwapU32(u32))
2309#else
2310# define RT_BSWAP_U32(u32) ASMByteSwapU32(u32)
2311#endif
2312
2313/** @def RT_BSWAP_U16
2314 * Reverses the byte order of an uint16_t value. */
2315#if 0
2316# define RT_BSWAP_U16(u16) RT_BSWAP_U16_C(u16)
2317#elif defined(__GNUC__)
2318# define RT_BSWAP_U16(u16) (__builtin_constant_p((u16)) \
2319 ? RT_BSWAP_U16_C(u16) : ASMByteSwapU16(u16))
2320#else
2321# define RT_BSWAP_U16(u16) ASMByteSwapU16(u16)
2322#endif
2323
2324
2325/** @def RT_BSWAP_U64_C
2326 * Reverses the byte order of an uint64_t constant. */
2327#define RT_BSWAP_U64_C(u64) RT_MAKE_U64(RT_BSWAP_U32_C((u64) >> 32), RT_BSWAP_U32_C((u64) & 0xffffffff))
2328
2329/** @def RT_BSWAP_U32_C
2330 * Reverses the byte order of an uint32_t constant. */
2331#define RT_BSWAP_U32_C(u32) RT_MAKE_U32_FROM_U8(RT_BYTE4(u32), RT_BYTE3(u32), RT_BYTE2(u32), RT_BYTE1(u32))
2332
2333/** @def RT_BSWAP_U16_C
2334 * Reverses the byte order of an uint16_t constant. */
2335#define RT_BSWAP_U16_C(u16) RT_MAKE_U16(RT_HIBYTE(u16), RT_LOBYTE(u16))
2336
2337
2338/** @def RT_H2LE_U64
2339 * Converts an uint64_t value from host to little endian byte order. */
2340#ifdef RT_BIG_ENDIAN
2341# define RT_H2LE_U64(u64) RT_BSWAP_U64(u64)
2342#else
2343# define RT_H2LE_U64(u64) (u64)
2344#endif
2345
2346/** @def RT_H2LE_U64_C
2347 * Converts an uint64_t constant from host to little endian byte order. */
2348#ifdef RT_BIG_ENDIAN
2349# define RT_H2LE_U64_C(u64) RT_BSWAP_U64_C(u64)
2350#else
2351# define RT_H2LE_U64_C(u64) (u64)
2352#endif
2353
2354/** @def RT_H2LE_U32
2355 * Converts an uint32_t value from host to little endian byte order. */
2356#ifdef RT_BIG_ENDIAN
2357# define RT_H2LE_U32(u32) RT_BSWAP_U32(u32)
2358#else
2359# define RT_H2LE_U32(u32) (u32)
2360#endif
2361
2362/** @def RT_H2LE_U32_C
2363 * Converts an uint32_t constant from host to little endian byte order. */
2364#ifdef RT_BIG_ENDIAN
2365# define RT_H2LE_U32_C(u32) RT_BSWAP_U32_C(u32)
2366#else
2367# define RT_H2LE_U32_C(u32) (u32)
2368#endif
2369
2370/** @def RT_H2LE_U16
2371 * Converts an uint16_t value from host to little endian byte order. */
2372#ifdef RT_BIG_ENDIAN
2373# define RT_H2LE_U16(u16) RT_BSWAP_U16(u16)
2374#else
2375# define RT_H2LE_U16(u16) (u16)
2376#endif
2377
2378/** @def RT_H2LE_U16_C
2379 * Converts an uint16_t constant from host to little endian byte order. */
2380#ifdef RT_BIG_ENDIAN
2381# define RT_H2LE_U16_C(u16) RT_BSWAP_U16_C(u16)
2382#else
2383# define RT_H2LE_U16_C(u16) (u16)
2384#endif
2385
2386
2387/** @def RT_LE2H_U64
2388 * Converts an uint64_t value from little endian to host byte order. */
2389#ifdef RT_BIG_ENDIAN
2390# define RT_LE2H_U64(u64) RT_BSWAP_U64(u64)
2391#else
2392# define RT_LE2H_U64(u64) (u64)
2393#endif
2394
2395/** @def RT_LE2H_U64_C
2396 * Converts an uint64_t constant from little endian to host byte order. */
2397#ifdef RT_BIG_ENDIAN
2398# define RT_LE2H_U64_C(u64) RT_BSWAP_U64_C(u64)
2399#else
2400# define RT_LE2H_U64_C(u64) (u64)
2401#endif
2402
2403/** @def RT_LE2H_U32
2404 * Converts an uint32_t value from little endian to host byte order. */
2405#ifdef RT_BIG_ENDIAN
2406# define RT_LE2H_U32(u32) RT_BSWAP_U32(u32)
2407#else
2408# define RT_LE2H_U32(u32) (u32)
2409#endif
2410
2411/** @def RT_LE2H_U32_C
2412 * Converts an uint32_t constant from little endian to host byte order. */
2413#ifdef RT_BIG_ENDIAN
2414# define RT_LE2H_U32_C(u32) RT_BSWAP_U32_C(u32)
2415#else
2416# define RT_LE2H_U32_C(u32) (u32)
2417#endif
2418
2419/** @def RT_LE2H_U16
2420 * Converts an uint16_t value from little endian to host byte order. */
2421#ifdef RT_BIG_ENDIAN
2422# define RT_LE2H_U16(u16) RT_BSWAP_U16(u16)
2423#else
2424# define RT_LE2H_U16(u16) (u16)
2425#endif
2426
2427/** @def RT_LE2H_U16_C
2428 * Converts an uint16_t constant from little endian to host byte order. */
2429#ifdef RT_BIG_ENDIAN
2430# define RT_LE2H_U16_C(u16) RT_BSWAP_U16_C(u16)
2431#else
2432# define RT_LE2H_U16_C(u16) (u16)
2433#endif
2434
2435
2436/** @def RT_H2BE_U64
2437 * Converts an uint64_t value from host to big endian byte order. */
2438#ifdef RT_BIG_ENDIAN
2439# define RT_H2BE_U64(u64) (u64)
2440#else
2441# define RT_H2BE_U64(u64) RT_BSWAP_U64(u64)
2442#endif
2443
2444/** @def RT_H2BE_U64_C
2445 * Converts an uint64_t constant from host to big endian byte order. */
2446#ifdef RT_BIG_ENDIAN
2447# define RT_H2BE_U64_C(u64) (u64)
2448#else
2449# define RT_H2BE_U64_C(u64) RT_BSWAP_U64_C(u64)
2450#endif
2451
2452/** @def RT_H2BE_U32
2453 * Converts an uint32_t value from host to big endian byte order. */
2454#ifdef RT_BIG_ENDIAN
2455# define RT_H2BE_U32(u32) (u32)
2456#else
2457# define RT_H2BE_U32(u32) RT_BSWAP_U32(u32)
2458#endif
2459
2460/** @def RT_H2BE_U32_C
2461 * Converts an uint32_t constant from host to big endian byte order. */
2462#ifdef RT_BIG_ENDIAN
2463# define RT_H2BE_U32_C(u32) (u32)
2464#else
2465# define RT_H2BE_U32_C(u32) RT_BSWAP_U32_C(u32)
2466#endif
2467
2468/** @def RT_H2BE_U16
2469 * Converts an uint16_t value from host to big endian byte order. */
2470#ifdef RT_BIG_ENDIAN
2471# define RT_H2BE_U16(u16) (u16)
2472#else
2473# define RT_H2BE_U16(u16) RT_BSWAP_U16(u16)
2474#endif
2475
2476/** @def RT_H2BE_U16_C
2477 * Converts an uint16_t constant from host to big endian byte order. */
2478#ifdef RT_BIG_ENDIAN
2479# define RT_H2BE_U16_C(u16) (u16)
2480#else
2481# define RT_H2BE_U16_C(u16) RT_BSWAP_U16_C(u16)
2482#endif
2483
2484/** @def RT_BE2H_U64
2485 * Converts an uint64_t value from big endian to host byte order. */
2486#ifdef RT_BIG_ENDIAN
2487# define RT_BE2H_U64(u64) (u64)
2488#else
2489# define RT_BE2H_U64(u64) RT_BSWAP_U64(u64)
2490#endif
2491
2492/** @def RT_BE2H_U64
2493 * Converts an uint64_t constant from big endian to host byte order. */
2494#ifdef RT_BIG_ENDIAN
2495# define RT_BE2H_U64_C(u64) (u64)
2496#else
2497# define RT_BE2H_U64_C(u64) RT_BSWAP_U64_C(u64)
2498#endif
2499
2500/** @def RT_BE2H_U32
2501 * Converts an uint32_t value from big endian to host byte order. */
2502#ifdef RT_BIG_ENDIAN
2503# define RT_BE2H_U32(u32) (u32)
2504#else
2505# define RT_BE2H_U32(u32) RT_BSWAP_U32(u32)
2506#endif
2507
2508/** @def RT_BE2H_U32_C
2509 * Converts an uint32_t value from big endian to host byte order. */
2510#ifdef RT_BIG_ENDIAN
2511# define RT_BE2H_U32_C(u32) (u32)
2512#else
2513# define RT_BE2H_U32_C(u32) RT_BSWAP_U32_C(u32)
2514#endif
2515
2516/** @def RT_BE2H_U16
2517 * Converts an uint16_t value from big endian to host byte order. */
2518#ifdef RT_BIG_ENDIAN
2519# define RT_BE2H_U16(u16) (u16)
2520#else
2521# define RT_BE2H_U16(u16) RT_BSWAP_U16(u16)
2522#endif
2523
2524/** @def RT_BE2H_U16_C
2525 * Converts an uint16_t constant from big endian to host byte order. */
2526#ifdef RT_BIG_ENDIAN
2527# define RT_BE2H_U16_C(u16) (u16)
2528#else
2529# define RT_BE2H_U16_C(u16) RT_BSWAP_U16_C(u16)
2530#endif
2531
2532
2533/** @def RT_H2N_U64
2534 * Converts an uint64_t value from host to network byte order. */
2535#define RT_H2N_U64(u64) RT_H2BE_U64(u64)
2536
2537/** @def RT_H2N_U64_C
2538 * Converts an uint64_t constant from host to network byte order. */
2539#define RT_H2N_U64_C(u64) RT_H2BE_U64_C(u64)
2540
2541/** @def RT_H2N_U32
2542 * Converts an uint32_t value from host to network byte order. */
2543#define RT_H2N_U32(u32) RT_H2BE_U32(u32)
2544
2545/** @def RT_H2N_U32_C
2546 * Converts an uint32_t constant from host to network byte order. */
2547#define RT_H2N_U32_C(u32) RT_H2BE_U32_C(u32)
2548
2549/** @def RT_H2N_U16
2550 * Converts an uint16_t value from host to network byte order. */
2551#define RT_H2N_U16(u16) RT_H2BE_U16(u16)
2552
2553/** @def RT_H2N_U16_C
2554 * Converts an uint16_t constant from host to network byte order. */
2555#define RT_H2N_U16_C(u16) RT_H2BE_U16_C(u16)
2556
2557/** @def RT_N2H_U64
2558 * Converts an uint64_t value from network to host byte order. */
2559#define RT_N2H_U64(u64) RT_BE2H_U64(u64)
2560
2561/** @def RT_N2H_U64_C
2562 * Converts an uint64_t constant from network to host byte order. */
2563#define RT_N2H_U64_C(u64) RT_BE2H_U64_C(u64)
2564
2565/** @def RT_N2H_U32
2566 * Converts an uint32_t value from network to host byte order. */
2567#define RT_N2H_U32(u32) RT_BE2H_U32(u32)
2568
2569/** @def RT_N2H_U32_C
2570 * Converts an uint32_t constant from network to host byte order. */
2571#define RT_N2H_U32_C(u32) RT_BE2H_U32_C(u32)
2572
2573/** @def RT_N2H_U16
2574 * Converts an uint16_t value from network to host byte order. */
2575#define RT_N2H_U16(u16) RT_BE2H_U16(u16)
2576
2577/** @def RT_N2H_U16_C
2578 * Converts an uint16_t value from network to host byte order. */
2579#define RT_N2H_U16_C(u16) RT_BE2H_U16_C(u16)
2580
2581
2582/*
2583 * The BSD sys/param.h + machine/param.h file is a major source of
2584 * namespace pollution. Kill off some of the worse ones unless we're
2585 * compiling kernel code.
2586 */
2587#if defined(RT_OS_DARWIN) \
2588 && !defined(KERNEL) \
2589 && !defined(RT_NO_BSD_PARAM_H_UNDEFING) \
2590 && ( defined(_SYS_PARAM_H_) || defined(_I386_PARAM_H_) )
2591/* sys/param.h: */
2592# undef PSWP
2593# undef PVM
2594# undef PINOD
2595# undef PRIBO
2596# undef PVFS
2597# undef PZERO
2598# undef PSOCK
2599# undef PWAIT
2600# undef PLOCK
2601# undef PPAUSE
2602# undef PUSER
2603# undef PRIMASK
2604# undef MINBUCKET
2605# undef MAXALLOCSAVE
2606# undef FSHIFT
2607# undef FSCALE
2608
2609/* i386/machine.h: */
2610# undef ALIGN
2611# undef ALIGNBYTES
2612# undef DELAY
2613# undef STATUS_WORD
2614# undef USERMODE
2615# undef BASEPRI
2616# undef MSIZE
2617# undef CLSIZE
2618# undef CLSIZELOG2
2619#endif
2620
2621/** @def NIL_OFFSET
2622 * NIL offset.
2623 * Whenever we use offsets instead of pointers to save space and relocation effort
2624 * NIL_OFFSET shall be used as the equivalent to NULL.
2625 */
2626#define NIL_OFFSET (~0U)
2627
2628/** @def NOREF
2629 * Keeps the compiler from bitching about an unused parameter.
2630 */
2631#define NOREF(var) (void)(var)
2632
2633/** @def RT_BREAKPOINT
2634 * Emit a debug breakpoint instruction.
2635 *
2636 * @remarks In the x86/amd64 gnu world we add a nop instruction after the int3
2637 * to force gdb to remain at the int3 source line.
2638 * @remarks The L4 kernel will try make sense of the breakpoint, thus the jmp on
2639 * x86/amd64.
2640 */
2641#ifdef __GNUC__
2642# if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
2643# if !defined(__L4ENV__)
2644# define RT_BREAKPOINT() __asm__ __volatile__("int $3\n\tnop\n\t")
2645# else
2646# define RT_BREAKPOINT() __asm__ __volatile__("int3; jmp 1f; 1:\n\t")
2647# endif
2648# elif defined(RT_ARCH_SPARC64)
2649# define RT_BREAKPOINT() __asm__ __volatile__("illtrap 0\n\t") /** @todo Sparc64: this is just a wild guess. */
2650# elif defined(RT_ARCH_SPARC)
2651# define RT_BREAKPOINT() __asm__ __volatile__("unimp 0\n\t") /** @todo Sparc: this is just a wild guess (same as Sparc64, just different name). */
2652# endif
2653#endif
2654#ifdef _MSC_VER
2655# define RT_BREAKPOINT() __debugbreak()
2656#endif
2657#if defined(__IBMC__) || defined(__IBMCPP__)
2658# define RT_BREAKPOINT() __interrupt(3)
2659#endif
2660#if defined(__WATCOMC__)
2661# define RT_BREAKPOINT() _asm { int 3 }
2662#endif
2663#ifndef RT_BREAKPOINT
2664# error "This compiler/arch is not supported!"
2665#endif
2666
2667
2668/** @defgroup grp_rt_cdefs_size Size Constants
2669 * (Of course, these are binary computer terms, not SI.)
2670 * @{
2671 */
2672/** 1 K (Kilo) (1 024). */
2673#define _1K 0x00000400
2674/** 2 K (Kilo) (2 048). */
2675#define _2K 0x00000800
2676/** 4 K (Kilo) (4 096). */
2677#define _4K 0x00001000
2678/** 8 K (Kilo) (8 192). */
2679#define _8K 0x00002000
2680/** 16 K (Kilo) (16 384). */
2681#define _16K 0x00004000
2682/** 32 K (Kilo) (32 678). */
2683#define _32K 0x00008000
2684/** 64 K (Kilo) (65 536). */
2685#if ARCH_BITS != 16
2686# define _64K 0x00010000
2687#else
2688# define _64K UINT32_C(0x00010000)
2689#endif
2690/** 128 K (Kilo) (131 072). */
2691#if ARCH_BITS != 16
2692# define _128K 0x00020000
2693#else
2694# define _128K UINT32_C(0x00020000)
2695#endif
2696/** 256 K (Kilo) (262 144). */
2697#if ARCH_BITS != 16
2698# define _256K 0x00040000
2699#else
2700# define _256K UINT32_C(0x00040000)
2701#endif
2702/** 512 K (Kilo) (524 288). */
2703#if ARCH_BITS != 16
2704# define _512K 0x00080000
2705#else
2706# define _512K UINT32_C(0x00080000)
2707#endif
2708/** 1 M (Mega) (1 048 576). */
2709#if ARCH_BITS != 16
2710# define _1M 0x00100000
2711#else
2712# define _1M UINT32_C(0x00100000)
2713#endif
2714/** 2 M (Mega) (2 097 152). */
2715#if ARCH_BITS != 16
2716# define _2M 0x00200000
2717#else
2718# define _2M UINT32_C(0x00200000)
2719#endif
2720/** 4 M (Mega) (4 194 304). */
2721#if ARCH_BITS != 16
2722# define _4M 0x00400000
2723#else
2724# define _4M UINT32_C(0x00400000)
2725#endif
2726/** 8 M (Mega) (8 388 608). */
2727#define _8M UINT32_C(0x00800000)
2728/** 16 M (Mega) (16 777 216). */
2729#define _16M UINT32_C(0x01000000)
2730/** 32 M (Mega) (33 554 432). */
2731#define _32M UINT32_C(0x02000000)
2732/** 64 M (Mega) (67 108 864). */
2733#define _64M UINT32_C(0x04000000)
2734/** 128 M (Mega) (134 217 728). */
2735#define _128M UINT32_C(0x08000000)
2736/** 256 M (Mega) (268 435 456). */
2737#define _256M UINT32_C(0x10000000)
2738/** 512 M (Mega) (536 870 912). */
2739#define _512M UINT32_C(0x20000000)
2740/** 1 G (Giga) (1 073 741 824). (32-bit) */
2741#if ARCH_BITS != 16
2742# define _1G 0x40000000
2743#else
2744# define _1G UINT32_C(0x40000000)
2745#endif
2746/** 1 G (Giga) (1 073 741 824). (64-bit) */
2747#if ARCH_BITS != 16
2748# define _1G64 0x40000000LL
2749#else
2750# define _1G64 UINT64_C(0x40000000)
2751#endif
2752/** 2 G (Giga) (2 147 483 648). (32-bit) */
2753#define _2G32 UINT32_C(0x80000000)
2754/** 2 G (Giga) (2 147 483 648). (64-bit) */
2755#if ARCH_BITS != 16
2756# define _2G 0x0000000080000000LL
2757#else
2758# define _2G UINT64_C(0x0000000080000000)
2759#endif
2760/** 4 G (Giga) (4 294 967 296). */
2761#if ARCH_BITS != 16
2762# define _4G 0x0000000100000000LL
2763#else
2764# define _4G UINT64_C(0x0000000100000000)
2765#endif
2766/** 1 T (Tera) (1 099 511 627 776). */
2767#if ARCH_BITS != 16
2768# define _1T 0x0000010000000000LL
2769#else
2770# define _1T UINT64_C(0x0000010000000000)
2771#endif
2772/** 1 P (Peta) (1 125 899 906 842 624). */
2773#if ARCH_BITS != 16
2774# define _1P 0x0004000000000000LL
2775#else
2776# define _1P UINT64_C(0x0004000000000000)
2777#endif
2778/** 1 E (Exa) (1 152 921 504 606 846 976). */
2779#if ARCH_BITS != 16
2780# define _1E 0x1000000000000000LL
2781#else
2782# define _1E UINT64_C(0x1000000000000000)
2783#endif
2784/** 2 E (Exa) (2 305 843 009 213 693 952). */
2785#if ARCH_BITS != 16
2786# define _2E 0x2000000000000000ULL
2787#else
2788# define _2E UINT64_C(0x2000000000000000)
2789#endif
2790/** @} */
2791
2792/** @defgroup grp_rt_cdefs_decimal_grouping Decimal Constant Grouping Macros
2793 * @{ */
2794#define RT_D1(g1) g1
2795#define RT_D2(g1, g2) g1#g2
2796#define RT_D3(g1, g2, g3) g1#g2#g3
2797#define RT_D4(g1, g2, g3, g4) g1#g2#g3#g4
2798#define RT_D5(g1, g2, g3, g4, g5) g1#g2#g3#g4#g5
2799#define RT_D6(g1, g2, g3, g4, g5, g6) g1#g2#g3#g4#g5#g6
2800#define RT_D7(g1, g2, g3, g4, g5, g6, g7) g1#g2#g3#g4#g5#g6#g7
2801
2802#define RT_D1_U(g1) UINT32_C(g1)
2803#define RT_D2_U(g1, g2) UINT32_C(g1#g2)
2804#define RT_D3_U(g1, g2, g3) UINT32_C(g1#g2#g3)
2805#define RT_D4_U(g1, g2, g3, g4) UINT64_C(g1#g2#g3#g4)
2806#define RT_D5_U(g1, g2, g3, g4, g5) UINT64_C(g1#g2#g3#g4#g5)
2807#define RT_D6_U(g1, g2, g3, g4, g5, g6) UINT64_C(g1#g2#g3#g4#g5#g6)
2808#define RT_D7_U(g1, g2, g3, g4, g5, g6, g7) UINT64_C(g1#g2#g3#g4#g5#g6#g7)
2809
2810#define RT_D1_S(g1) INT32_C(g1)
2811#define RT_D2_S(g1, g2) INT32_C(g1#g2)
2812#define RT_D3_S(g1, g2, g3) INT32_C(g1#g2#g3)
2813#define RT_D4_S(g1, g2, g3, g4) INT64_C(g1#g2#g3#g4)
2814#define RT_D5_S(g1, g2, g3, g4, g5) INT64_C(g1#g2#g3#g4#g5)
2815#define RT_D6_S(g1, g2, g3, g4, g5, g6) INT64_C(g1#g2#g3#g4#g5#g6)
2816#define RT_D7_S(g1, g2, g3, g4, g5, g6, g7) INT64_C(g1#g2#g3#g4#g5#g6#g7)
2817
2818#define RT_D1_U32(g1) UINT32_C(g1)
2819#define RT_D2_U32(g1, g2) UINT32_C(g1#g2)
2820#define RT_D3_U32(g1, g2, g3) UINT32_C(g1#g2#g3)
2821#define RT_D4_U32(g1, g2, g3, g4) UINT32_C(g1#g2#g3#g4)
2822
2823#define RT_D1_S32(g1) INT32_C(g1)
2824#define RT_D2_S32(g1, g2) INT32_C(g1#g2)
2825#define RT_D3_S32(g1, g2, g3) INT32_C(g1#g2#g3)
2826#define RT_D4_S32(g1, g2, g3, g4) INT32_C(g1#g2#g3#g4)
2827
2828#define RT_D1_U64(g1) UINT64_C(g1)
2829#define RT_D2_U64(g1, g2) UINT64_C(g1#g2)
2830#define RT_D3_U64(g1, g2, g3) UINT64_C(g1#g2#g3)
2831#define RT_D4_U64(g1, g2, g3, g4) UINT64_C(g1#g2#g3#g4)
2832#define RT_D5_U64(g1, g2, g3, g4, g5) UINT64_C(g1#g2#g3#g4#g5)
2833#define RT_D6_U64(g1, g2, g3, g4, g5, g6) UINT64_C(g1#g2#g3#g4#g5#g6)
2834#define RT_D7_U64(g1, g2, g3, g4, g5, g6, g7) UINT64_C(g1#g2#g3#g4#g5#g6#g7)
2835
2836#define RT_D1_S64(g1) INT64_C(g1)
2837#define RT_D2_S64(g1, g2) INT64_C(g1#g2)
2838#define RT_D3_S64(g1, g2, g3) INT64_C(g1#g2#g3)
2839#define RT_D4_S64(g1, g2, g3, g4) INT64_C(g1#g2#g3#g4)
2840#define RT_D5_S64(g1, g2, g3, g4, g5) INT64_C(g1#g2#g3#g4#g5)
2841#define RT_D6_S64(g1, g2, g3, g4, g5, g6) INT64_C(g1#g2#g3#g4#g5#g6)
2842#define RT_D7_S64(g1, g2, g3, g4, g5, g6, g7) INT64_C(g1#g2#g3#g4#g5#g6#g7)
2843/** @} */
2844
2845
2846/** @defgroup grp_rt_cdefs_time Time Constants
2847 * @{
2848 */
2849/** 1 hour expressed in nanoseconds (64-bit). */
2850#define RT_NS_1HOUR UINT64_C(3600000000000)
2851/** 1 minute expressed in nanoseconds (64-bit). */
2852#define RT_NS_1MIN UINT64_C(60000000000)
2853/** 45 second expressed in nanoseconds. */
2854#define RT_NS_45SEC UINT64_C(45000000000)
2855/** 30 second expressed in nanoseconds. */
2856#define RT_NS_30SEC UINT64_C(30000000000)
2857/** 20 second expressed in nanoseconds. */
2858#define RT_NS_20SEC UINT64_C(20000000000)
2859/** 15 second expressed in nanoseconds. */
2860#define RT_NS_15SEC UINT64_C(15000000000)
2861/** 10 second expressed in nanoseconds. */
2862#define RT_NS_10SEC UINT64_C(10000000000)
2863/** 1 second expressed in nanoseconds. */
2864#define RT_NS_1SEC UINT32_C(1000000000)
2865/** 100 millsecond expressed in nanoseconds. */
2866#define RT_NS_100MS UINT32_C(100000000)
2867/** 10 millsecond expressed in nanoseconds. */
2868#define RT_NS_10MS UINT32_C(10000000)
2869/** 1 millsecond expressed in nanoseconds. */
2870#define RT_NS_1MS UINT32_C(1000000)
2871/** 100 microseconds expressed in nanoseconds. */
2872#define RT_NS_100US UINT32_C(100000)
2873/** 10 microseconds expressed in nanoseconds. */
2874#define RT_NS_10US UINT32_C(10000)
2875/** 1 microsecond expressed in nanoseconds. */
2876#define RT_NS_1US UINT32_C(1000)
2877
2878/** 1 second expressed in nanoseconds - 64-bit type. */
2879#define RT_NS_1SEC_64 UINT64_C(1000000000)
2880/** 100 millsecond expressed in nanoseconds - 64-bit type. */
2881#define RT_NS_100MS_64 UINT64_C(100000000)
2882/** 10 millsecond expressed in nanoseconds - 64-bit type. */
2883#define RT_NS_10MS_64 UINT64_C(10000000)
2884/** 1 millsecond expressed in nanoseconds - 64-bit type. */
2885#define RT_NS_1MS_64 UINT64_C(1000000)
2886/** 100 microseconds expressed in nanoseconds - 64-bit type. */
2887#define RT_NS_100US_64 UINT64_C(100000)
2888/** 10 microseconds expressed in nanoseconds - 64-bit type. */
2889#define RT_NS_10US_64 UINT64_C(10000)
2890/** 1 microsecond expressed in nanoseconds - 64-bit type. */
2891#define RT_NS_1US_64 UINT64_C(1000)
2892
2893/** 1 hour expressed in microseconds. */
2894#define RT_US_1HOUR UINT32_C(3600000000)
2895/** 1 minute expressed in microseconds. */
2896#define RT_US_1MIN UINT32_C(60000000)
2897/** 1 second expressed in microseconds. */
2898#define RT_US_1SEC UINT32_C(1000000)
2899/** 100 millsecond expressed in microseconds. */
2900#define RT_US_100MS UINT32_C(100000)
2901/** 10 millsecond expressed in microseconds. */
2902#define RT_US_10MS UINT32_C(10000)
2903/** 1 millsecond expressed in microseconds. */
2904#define RT_US_1MS UINT32_C(1000)
2905
2906/** 1 hour expressed in microseconds - 64-bit type. */
2907#define RT_US_1HOUR_64 UINT64_C(3600000000)
2908/** 1 minute expressed in microseconds - 64-bit type. */
2909#define RT_US_1MIN_64 UINT64_C(60000000)
2910/** 1 second expressed in microseconds - 64-bit type. */
2911#define RT_US_1SEC_64 UINT64_C(1000000)
2912/** 100 millsecond expressed in microseconds - 64-bit type. */
2913#define RT_US_100MS_64 UINT64_C(100000)
2914/** 10 millsecond expressed in microseconds - 64-bit type. */
2915#define RT_US_10MS_64 UINT64_C(10000)
2916/** 1 millsecond expressed in microseconds - 64-bit type. */
2917#define RT_US_1MS_64 UINT64_C(1000)
2918
2919/** 1 hour expressed in milliseconds. */
2920#define RT_MS_1HOUR UINT32_C(3600000)
2921/** 1 minute expressed in milliseconds. */
2922#define RT_MS_1MIN UINT32_C(60000)
2923/** 1 second expressed in milliseconds. */
2924#define RT_MS_1SEC UINT32_C(1000)
2925
2926/** 1 hour expressed in milliseconds - 64-bit type. */
2927#define RT_MS_1HOUR_64 UINT64_C(3600000)
2928/** 1 minute expressed in milliseconds - 64-bit type. */
2929#define RT_MS_1MIN_64 UINT64_C(60000)
2930/** 1 second expressed in milliseconds - 64-bit type. */
2931#define RT_MS_1SEC_64 UINT64_C(1000)
2932
2933/** The number of seconds per week. */
2934#define RT_SEC_1WEEK UINT32_C(604800)
2935/** The number of seconds per day. */
2936#define RT_SEC_1DAY UINT32_C(86400)
2937/** The number of seconds per hour. */
2938#define RT_SEC_1HOUR UINT32_C(3600)
2939
2940/** The number of seconds per week - 64-bit type. */
2941#define RT_SEC_1WEEK_64 UINT64_C(604800)
2942/** The number of seconds per day - 64-bit type. */
2943#define RT_SEC_1DAY_64 UINT64_C(86400)
2944/** The number of seconds per hour - 64-bit type. */
2945#define RT_SEC_1HOUR_64 UINT64_C(3600)
2946/** @} */
2947
2948
2949/** @defgroup grp_rt_cdefs_dbgtype Debug Info Types
2950 * @{ */
2951/** Other format. */
2952#define RT_DBGTYPE_OTHER RT_BIT_32(0)
2953/** Stabs. */
2954#define RT_DBGTYPE_STABS RT_BIT_32(1)
2955/** Debug With Arbitrary Record Format (DWARF). */
2956#define RT_DBGTYPE_DWARF RT_BIT_32(2)
2957/** Microsoft Codeview debug info. */
2958#define RT_DBGTYPE_CODEVIEW RT_BIT_32(3)
2959/** Watcom debug info. */
2960#define RT_DBGTYPE_WATCOM RT_BIT_32(4)
2961/** IBM High Level Language debug info. */
2962#define RT_DBGTYPE_HLL RT_BIT_32(5)
2963/** Old OS/2 and Windows symbol file. */
2964#define RT_DBGTYPE_SYM RT_BIT_32(6)
2965/** Map file. */
2966#define RT_DBGTYPE_MAP RT_BIT_32(7)
2967/** @} */
2968
2969
2970/** @defgroup grp_rt_cdefs_exetype Executable Image Types
2971 * @{ */
2972/** Some other format. */
2973#define RT_EXETYPE_OTHER RT_BIT_32(0)
2974/** Portable Executable. */
2975#define RT_EXETYPE_PE RT_BIT_32(1)
2976/** Linear eXecutable. */
2977#define RT_EXETYPE_LX RT_BIT_32(2)
2978/** Linear Executable. */
2979#define RT_EXETYPE_LE RT_BIT_32(3)
2980/** New Executable. */
2981#define RT_EXETYPE_NE RT_BIT_32(4)
2982/** DOS Executable (Mark Zbikowski). */
2983#define RT_EXETYPE_MZ RT_BIT_32(5)
2984/** COM Executable. */
2985#define RT_EXETYPE_COM RT_BIT_32(6)
2986/** a.out Executable. */
2987#define RT_EXETYPE_AOUT RT_BIT_32(7)
2988/** Executable and Linkable Format. */
2989#define RT_EXETYPE_ELF RT_BIT_32(8)
2990/** Mach-O Executable (including FAT ones). */
2991#define RT_EXETYPE_MACHO RT_BIT_32(9)
2992/** TE from UEFI. */
2993#define RT_EXETYPE_TE RT_BIT_32(9)
2994/** @} */
2995
2996
2997/** @def VALID_PTR
2998 * Pointer validation macro.
2999 * @param ptr The pointer.
3000 */
3001#if defined(RT_ARCH_AMD64)
3002# ifdef IN_RING3
3003# if defined(RT_OS_DARWIN) /* first 4GB is reserved for legacy kernel. */
3004# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) >= _4G \
3005 && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )
3006# elif defined(RT_OS_SOLARIS) /* The kernel only used the top 2TB, but keep it simple. */
3007# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
3008 && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \
3009 || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )
3010# else
3011# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
3012 && !((uintptr_t)(ptr) & 0xffff800000000000ULL) )
3013# endif
3014# else /* !IN_RING3 */
3015# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U \
3016 && ( ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0xffff800000000000ULL \
3017 || ((uintptr_t)(ptr) & 0xffff800000000000ULL) == 0) )
3018# endif /* !IN_RING3 */
3019
3020#elif defined(RT_ARCH_X86)
3021# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )
3022
3023#elif defined(RT_ARCH_SPARC64)
3024# ifdef IN_RING3
3025# if defined(RT_OS_SOLARIS)
3026/** Sparc64 user mode: According to Figure 9.4 in solaris internals */
3027/** @todo # define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x80004000U >= 0x80004000U + 0x100000000ULL ) - figure this. */
3028# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x80000000U >= 0x80000000U + 0x100000000ULL )
3029# else
3030# error "Port me"
3031# endif
3032# else /* !IN_RING3 */
3033# if defined(RT_OS_SOLARIS)
3034/** @todo Sparc64 kernel mode: This is according to Figure 11.1 in solaris
3035 * internals. Verify in sources. */
3036# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) >= 0x01000000U )
3037# else
3038# error "Port me"
3039# endif
3040# endif /* !IN_RING3 */
3041
3042#elif defined(RT_ARCH_SPARC)
3043# ifdef IN_RING3
3044# ifdef RT_OS_SOLARIS
3045/** Sparc user mode: According to
3046 * http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/sun4/os/startup.c#510 */
3047# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x400000U >= 0x400000U + 0x2000U )
3048
3049# else
3050# error "Port me"
3051# endif
3052# else /* !IN_RING3 */
3053# ifdef RT_OS_SOLARIS
3054/** @todo Sparc kernel mode: Check the sources! */
3055# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )
3056# else
3057# error "Port me"
3058# endif
3059# endif /* !IN_RING3 */
3060
3061#elif defined(RT_ARCH_ARM)
3062/* ASSUMES that at least the last and first 4K are out of bounds. */
3063# define RT_VALID_PTR(ptr) ( (uintptr_t)(ptr) + 0x1000U >= 0x2000U )
3064
3065#else
3066# error "Architecture identifier missing / not implemented."
3067#endif
3068
3069/** Old name for RT_VALID_PTR. */
3070#define VALID_PTR(ptr) RT_VALID_PTR(ptr)
3071
3072/** @def RT_VALID_ALIGNED_PTR
3073 * Pointer validation macro that also checks the alignment.
3074 * @param ptr The pointer.
3075 * @param align The alignment, must be a power of two.
3076 */
3077#define RT_VALID_ALIGNED_PTR(ptr, align) \
3078 ( !((uintptr_t)(ptr) & (uintptr_t)((align) - 1)) \
3079 && VALID_PTR(ptr) )
3080
3081
3082/** @def VALID_PHYS32
3083 * 32 bits physical address validation macro.
3084 * @param Phys The RTGCPHYS address.
3085 */
3086#define VALID_PHYS32(Phys) ( (uint64_t)(Phys) < (uint64_t)_4G )
3087
3088/** @def N_
3089 * The \#define N_ is used to mark a string for translation. This is usable in
3090 * any part of the code, as it is only used by the tools that create message
3091 * catalogs. This macro is a no-op as far as the compiler and code generation
3092 * is concerned.
3093 *
3094 * If you want to both mark a string for translation and translate it, use _().
3095 */
3096#define N_(s) (s)
3097
3098/** @def _
3099 * The \#define _ is used to mark a string for translation and to translate it
3100 * in one step.
3101 *
3102 * If you want to only mark a string for translation, use N_().
3103 */
3104#define _(s) gettext(s)
3105
3106
3107/** @def __PRETTY_FUNCTION__
3108 * With GNU C we'd like to use the builtin __PRETTY_FUNCTION__, so define that
3109 * for the other compilers.
3110 */
3111#if !defined(__GNUC__) && !defined(__PRETTY_FUNCTION__)
3112# ifdef _MSC_VER
3113# define __PRETTY_FUNCTION__ __FUNCSIG__
3114# else
3115# define __PRETTY_FUNCTION__ __FUNCTION__
3116# endif
3117#endif
3118
3119
3120/** @def RT_STRICT
3121 * The \#define RT_STRICT controls whether or not assertions and other runtime
3122 * checks should be compiled in or not. This is defined when DEBUG is defined.
3123 * If RT_NO_STRICT is defined, it will unconditionally be undefined.
3124 *
3125 * If you want assertions which are not subject to compile time options use
3126 * the AssertRelease*() flavors.
3127 */
3128#if !defined(RT_STRICT) && defined(DEBUG)
3129# define RT_STRICT
3130#endif
3131#ifdef RT_NO_STRICT
3132# undef RT_STRICT
3133#endif
3134
3135/** @todo remove this: */
3136#if !defined(RT_LOCK_STRICT) && !defined(DEBUG_bird)
3137# define RT_LOCK_NO_STRICT
3138#endif
3139#if !defined(RT_LOCK_STRICT_ORDER) && !defined(DEBUG_bird)
3140# define RT_LOCK_NO_STRICT_ORDER
3141#endif
3142
3143/** @def RT_LOCK_STRICT
3144 * The \#define RT_LOCK_STRICT controls whether deadlock detection and related
3145 * checks are done in the lock and semaphore code. It is by default enabled in
3146 * RT_STRICT builds, but this behavior can be overridden by defining
3147 * RT_LOCK_NO_STRICT. */
3148#if !defined(RT_LOCK_STRICT) && !defined(RT_LOCK_NO_STRICT) && defined(RT_STRICT)
3149# define RT_LOCK_STRICT
3150#endif
3151/** @def RT_LOCK_NO_STRICT
3152 * The \#define RT_LOCK_NO_STRICT disables RT_LOCK_STRICT. */
3153#if defined(RT_LOCK_NO_STRICT) && defined(RT_LOCK_STRICT)
3154# undef RT_LOCK_STRICT
3155#endif
3156
3157/** @def RT_LOCK_STRICT_ORDER
3158 * The \#define RT_LOCK_STRICT_ORDER controls whether locking order is checked
3159 * by the lock and semaphore code. It is by default enabled in RT_STRICT
3160 * builds, but this behavior can be overridden by defining
3161 * RT_LOCK_NO_STRICT_ORDER. */
3162#if !defined(RT_LOCK_STRICT_ORDER) && !defined(RT_LOCK_NO_STRICT_ORDER) && defined(RT_STRICT)
3163# define RT_LOCK_STRICT_ORDER
3164#endif
3165/** @def RT_LOCK_NO_STRICT_ORDER
3166 * The \#define RT_LOCK_NO_STRICT_ORDER disables RT_LOCK_STRICT_ORDER. */
3167#if defined(RT_LOCK_NO_STRICT_ORDER) && defined(RT_LOCK_STRICT_ORDER)
3168# undef RT_LOCK_STRICT_ORDER
3169#endif
3170
3171
3172/** Source position. */
3173#define RT_SRC_POS __FILE__, __LINE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__
3174
3175/** Source position declaration. */
3176#define RT_SRC_POS_DECL const char *pszFile, unsigned iLine, const char *pszFunction
3177
3178/** Source position arguments. */
3179#define RT_SRC_POS_ARGS pszFile, iLine, pszFunction
3180
3181/** Applies NOREF() to the source position arguments. */
3182#define RT_SRC_POS_NOREF() do { NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); } while (0)
3183
3184
3185/** @def RT_INLINE_ASM_EXTERNAL
3186 * Defined as 1 if the compiler does not support inline assembly.
3187 * The ASM* functions will then be implemented in external .asm files.
3188 */
3189#if (defined(_MSC_VER) && defined(RT_ARCH_AMD64)) \
3190 || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86)) \
3191 || defined(__WATCOMC__)
3192# define RT_INLINE_ASM_EXTERNAL 1
3193#else
3194# define RT_INLINE_ASM_EXTERNAL 0
3195#endif
3196
3197/** @def RT_INLINE_ASM_GNU_STYLE
3198 * Defined as 1 if the compiler understands GNU style inline assembly.
3199 */
3200#if defined(_MSC_VER) || defined(__WATCOMC__)
3201# define RT_INLINE_ASM_GNU_STYLE 0
3202#else
3203# define RT_INLINE_ASM_GNU_STYLE 1
3204#endif
3205
3206/** @def RT_INLINE_ASM_USES_INTRIN
3207 * Defined as the major MSC version if the compiler have and uses intrin.h.
3208 * Otherwise it is 0. */
3209#ifdef _MSC_VER
3210# if _MSC_VER >= 1700 /* Visual C++ v11.0 / 2012 */
3211# define RT_INLINE_ASM_USES_INTRIN 17
3212# elif _MSC_VER >= 1600 /* Visual C++ v10.0 / 2010 */
3213# define RT_INLINE_ASM_USES_INTRIN 16
3214# elif _MSC_VER >= 1500 /* Visual C++ v9.0 / 2008 */
3215# define RT_INLINE_ASM_USES_INTRIN 15
3216# elif _MSC_VER >= 1400 /* Visual C++ v8.0 / 2005 */
3217# define RT_INLINE_ASM_USES_INTRIN 14
3218# endif
3219#endif
3220#ifndef RT_INLINE_ASM_USES_INTRIN
3221# define RT_INLINE_ASM_USES_INTRIN 0
3222#endif
3223
3224/** @def RT_COMPILER_SUPPORTS_LAMBDA
3225 * If the defined, the compiler supports lambda expressions. These expressions
3226 * are useful for embedding assertions and type checks into macros. */
3227#if defined(_MSC_VER) && defined(__cplusplus)
3228# if _MSC_VER >= 1600 /* Visual C++ v10.0 / 2010 */
3229# define RT_COMPILER_SUPPORTS_LAMBDA
3230# endif
3231#elif defined(__GNUC__) && defined(__cplusplus)
3232/* 4.5 or later, I think, if in ++11 mode... */
3233#endif
3234
3235/** @def RT_FAR_DATA
3236 * Set to 1 if we're in 16-bit mode and use far pointers.
3237 */
3238#if ARCH_BITS == 16 && defined(__WATCOMC__) \
3239 && (defined(__COMPACT__) || defined(__LARGE__))
3240# define RT_FAR_DATA 1
3241#else
3242# define RT_FAR_DATA 0
3243#endif
3244
3245/** @} */
3246
3247
3248/** @defgroup grp_rt_cdefs_cpp Special Macros for C++
3249 * @ingroup grp_rt_cdefs
3250 * @{
3251 */
3252
3253#ifdef __cplusplus
3254
3255/** @def DECLEXPORT_CLASS
3256 * How to declare an exported class. Place this macro after the 'class'
3257 * keyword in the declaration of every class you want to export.
3258 *
3259 * @note It is necessary to use this macro even for inner classes declared
3260 * inside the already exported classes. This is a GCC specific requirement,
3261 * but it seems not to harm other compilers.
3262 */
3263#if defined(_MSC_VER) || defined(RT_OS_OS2)
3264# define DECLEXPORT_CLASS __declspec(dllexport)
3265#elif defined(RT_USE_VISIBILITY_DEFAULT)
3266# define DECLEXPORT_CLASS __attribute__((visibility("default")))
3267#else
3268# define DECLEXPORT_CLASS
3269#endif
3270
3271/** @def DECLIMPORT_CLASS
3272 * How to declare an imported class Place this macro after the 'class'
3273 * keyword in the declaration of every class you want to export.
3274 *
3275 * @note It is necessary to use this macro even for inner classes declared
3276 * inside the already exported classes. This is a GCC specific requirement,
3277 * but it seems not to harm other compilers.
3278 */
3279#if defined(_MSC_VER) || (defined(RT_OS_OS2) && !defined(__IBMC__) && !defined(__IBMCPP__))
3280# define DECLIMPORT_CLASS __declspec(dllimport)
3281#elif defined(RT_USE_VISIBILITY_DEFAULT)
3282# define DECLIMPORT_CLASS __attribute__((visibility("default")))
3283#else
3284# define DECLIMPORT_CLASS
3285#endif
3286
3287/** @def WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP
3288 * Macro to work around error C2593 of the not-so-smart MSVC 7.x ambiguity
3289 * resolver. The following snippet clearly demonstrates the code causing this
3290 * error:
3291 * @code
3292 * class A
3293 * {
3294 * public:
3295 * operator bool() const { return false; }
3296 * operator int*() const { return NULL; }
3297 * };
3298 * int main()
3299 * {
3300 * A a;
3301 * if (!a);
3302 * if (a && 0);
3303 * return 0;
3304 * }
3305 * @endcode
3306 * The code itself seems pretty valid to me and GCC thinks the same.
3307 *
3308 * This macro fixes the compiler error by explicitly overloading implicit
3309 * global operators !, && and || that take the given class instance as one of
3310 * their arguments.
3311 *
3312 * The best is to use this macro right after the class declaration.
3313 *
3314 * @note The macro expands to nothing for compilers other than MSVC.
3315 *
3316 * @param Cls Class to apply the workaround to
3317 */
3318#if defined(_MSC_VER)
3319# define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls) \
3320 inline bool operator! (const Cls &that) { return !bool (that); } \
3321 inline bool operator&& (const Cls &that, bool b) { return bool (that) && b; } \
3322 inline bool operator|| (const Cls &that, bool b) { return bool (that) || b; } \
3323 inline bool operator&& (bool b, const Cls &that) { return b && bool (that); } \
3324 inline bool operator|| (bool b, const Cls &that) { return b || bool (that); }
3325#else
3326# define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP(Cls)
3327#endif
3328
3329/** @def WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL
3330 * Version of WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP for template classes.
3331 *
3332 * @param Tpl Name of the template class to apply the workaround to
3333 * @param ArgsDecl arguments of the template, as declared in |<>| after the
3334 * |template| keyword, including |<>|
3335 * @param Args arguments of the template, as specified in |<>| after the
3336 * template class name when using the, including |<>|
3337 *
3338 * Example:
3339 * @code
3340 * // template class declaration
3341 * template <class C>
3342 * class Foo { ... };
3343 * // applied workaround
3344 * WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL (Foo, <class C>, <C>)
3345 * @endcode
3346 */
3347#if defined(_MSC_VER)
3348# define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL(Tpl, ArgsDecl, Args) \
3349 template ArgsDecl \
3350 inline bool operator! (const Tpl Args &that) { return !bool (that); } \
3351 template ArgsDecl \
3352 inline bool operator&& (const Tpl Args &that, bool b) { return bool (that) && b; } \
3353 template ArgsDecl \
3354 inline bool operator|| (const Tpl Args &that, bool b) { return bool (that) || b; } \
3355 template ArgsDecl \
3356 inline bool operator&& (bool b, const Tpl Args &that) { return b && bool (that); } \
3357 template ArgsDecl \
3358 inline bool operator|| (bool b, const Tpl Args &that) { return b || bool (that); }
3359#else
3360# define WORKAROUND_MSVC7_ERROR_C2593_FOR_BOOL_OP_TPL(Tpl, ArgsDecl, Args)
3361#endif
3362
3363
3364/** @def DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP
3365 * Declares the copy constructor and the assignment operation as inlined no-ops
3366 * (non-existent functions) for the given class. Use this macro inside the
3367 * private section if you want to effectively disable these operations for your
3368 * class.
3369 *
3370 * @param Cls class name to declare for
3371 */
3372
3373#define DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Cls) \
3374 inline Cls (const Cls &); \
3375 inline Cls &operator= (const Cls &);
3376
3377
3378/** @def DECLARE_CLS_NEW_DELETE_NOOP
3379 * Declares the new and delete operations as no-ops (non-existent functions)
3380 * for the given class. Use this macro inside the private section if you want
3381 * to effectively limit creating class instances on the stack only.
3382 *
3383 * @note The destructor of the given class must not be virtual, otherwise a
3384 * compile time error will occur. Note that this is not a drawback: having
3385 * the virtual destructor for a stack-based class is absolutely useless
3386 * (the real class of the stack-based instance is always known to the compiler
3387 * at compile time, so it will always call the correct destructor).
3388 *
3389 * @param Cls class name to declare for
3390 */
3391#define DECLARE_CLS_NEW_DELETE_NOOP(Cls) \
3392 inline static void *operator new (size_t); \
3393 inline static void operator delete (void *);
3394
3395#endif /* __cplusplus */
3396
3397/** @} */
3398
3399#endif
3400
Note: See TracBrowser for help on using the repository browser.

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