VirtualBox

Changeset 21106 in vbox for trunk


Ignore:
Timestamp:
Jun 30, 2009 10:58:18 PM (16 years ago)
Author:
vboxsync
Message:

iprt/types.h: _MAX & _MIN defines for a bunch of types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/types.h

    r20740 r21106  
    516516/** HC Natural signed integer.
    517517 * @deprecated silly type. */
    518 typedef int32_t         RTHCINT;
     518typedef int32_t             RTHCINT;
    519519/** Pointer to HC Natural signed integer.
    520520 * @deprecated silly type. */
    521 typedef RTHCINT        *PRTHCINT;
     521typedef RTHCINT            *PRTHCINT;
    522522/** Pointer to const HC Natural signed integer.
    523523 * @deprecated silly type. */
    524 typedef const RTHCINT  *PCRTHCINT;
     524typedef const RTHCINT      *PCRTHCINT;
    525525
    526526/** HC Natural unsigned integer.
    527527 * @deprecated silly type. */
    528 typedef uint32_t        RTHCUINT;
     528typedef uint32_t            RTHCUINT;
    529529/** Pointer to HC Natural unsigned integer.
    530530 * @deprecated silly type. */
    531 typedef RTHCUINT       *PRTHCUINT;
     531typedef RTHCUINT           *PRTHCUINT;
    532532/** Pointer to const HC Natural unsigned integer.
    533533 * @deprecated silly type. */
    534 typedef const RTHCUINT *PCRTHCUINT;
     534typedef const RTHCUINT     *PCRTHCUINT;
    535535
    536536
    537537/** Signed integer which can contain a HC pointer. */
    538538#if HC_ARCH_BITS == 32
    539 typedef int32_t         RTHCINTPTR;
     539typedef int32_t             RTHCINTPTR;
    540540#elif HC_ARCH_BITS == 64
    541 typedef int64_t         RTHCINTPTR;
    542 #else
    543 #  error Unsupported HC_ARCH_BITS value.
     541typedef int64_t             RTHCINTPTR;
     542#else
     543# error Unsupported HC_ARCH_BITS value.
    544544#endif
    545545/** Pointer to signed integer which can contain a HC pointer. */
    546 typedef RTHCINTPTR     *PRTHCINTPTR;
     546typedef RTHCINTPTR         *PRTHCINTPTR;
    547547/** Pointer to const signed integer which can contain a HC pointer. */
    548 typedef const RTHCINTPTR *PCRTHCINTPTR;
     548typedef const RTHCINTPTR   *PCRTHCINTPTR;
     549/** Max RTHCINTPTR value. */
     550#if HC_ARCH_BITS == 32
     551# define RTHCINTPTR_MAX     INT32_MAX
     552#else
     553# define RTHCINTPTR_MAX     INT64_MAX
     554#endif
     555/** Min RTHCINTPTR value. */
     556#if HC_ARCH_BITS == 32
     557# define RTHCINTPTR_MIN     INT32_MIN
     558#else
     559# define RTHCINTPTR_MIN     INT64_MIN
     560#endif
    549561
    550562/** Signed integer which can contain a HC ring-3 pointer. */
    551563#if R3_ARCH_BITS == 32
    552 typedef int32_t         RTR3INTPTR;
     564typedef int32_t             RTR3INTPTR;
    553565#elif R3_ARCH_BITS == 64
    554 typedef int64_t         RTR3INTPTR;
     566typedef int64_t             RTR3INTPTR;
    555567#else
    556568#  error Unsupported R3_ARCH_BITS value.
    557569#endif
    558570/** Pointer to signed integer which can contain a HC ring-3 pointer. */
    559 typedef RTR3INTPTR     *PRTR3INTPTR;
     571typedef RTR3INTPTR         *PRTR3INTPTR;
    560572/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
    561 typedef const RTR3INTPTR *PCRTR3INTPTR;
     573typedef const RTR3INTPTR   *PCRTR3INTPTR;
     574/** Max RTR3INTPTR value. */
     575#if R3_ARCH_BITS == 32
     576# define RTR3INTPTR_MAX     INT32_MAX
     577#else
     578# define RTR3INTPTR_MAX     INT64_MAX
     579#endif
     580/** Min RTR3INTPTR value. */
     581#if R3_ARCH_BITS == 32
     582# define RTR3INTPTR_MIN     INT32_MIN
     583#else
     584# define RTR3INTPTR_MIN     INT64_MIN
     585#endif
    562586
    563587/** Signed integer which can contain a HC ring-0 pointer. */
    564588#if R0_ARCH_BITS == 32
    565 typedef int32_t         RTR0INTPTR;
     589typedef int32_t             RTR0INTPTR;
    566590#elif R0_ARCH_BITS == 64
    567 typedef int64_t         RTR0INTPTR;
    568 #else
    569 #  error Unsupported R0_ARCH_BITS value.
     591typedef int64_t             RTR0INTPTR;
     592#else
     593# error Unsupported R0_ARCH_BITS value.
    570594#endif
    571595/** Pointer to signed integer which can contain a HC ring-0 pointer. */
    572 typedef RTR0INTPTR     *PRTR0INTPTR;
     596typedef RTR0INTPTR         *PRTR0INTPTR;
    573597/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
    574 typedef const RTR0INTPTR *PCRTR0INTPTR;
     598typedef const RTR0INTPTR   *PCRTR0INTPTR;
     599/** Max RTR0INTPTR value. */
     600#if R0_ARCH_BITS == 32
     601# define RTR0INTPTR_MAX     INT32_MAX
     602#else
     603# define RTR0INTPTR_MAX     INT64_MAX
     604#endif
     605/** Min RTHCINTPTR value. */
     606#if R0_ARCH_BITS == 32
     607# define RTR0INTPTR_MIN     INT32_MIN
     608#else
     609# define RTR0INTPTR_MIN     INT64_MIN
     610#endif
    575611
    576612
    577613/** Unsigned integer which can contain a HC pointer. */
    578614#if HC_ARCH_BITS == 32
    579 typedef uint32_t        RTHCUINTPTR;
     615typedef uint32_t            RTHCUINTPTR;
    580616#elif HC_ARCH_BITS == 64
    581 typedef uint64_t        RTHCUINTPTR;
    582 #else
    583 #  error Unsupported HC_ARCH_BITS value.
     617typedef uint64_t            RTHCUINTPTR;
     618#else
     619# error Unsupported HC_ARCH_BITS value.
    584620#endif
    585621/** Pointer to unsigned integer which can contain a HC pointer. */
    586 typedef RTHCUINTPTR    *PRTHCUINTPTR;
     622typedef RTHCUINTPTR        *PRTHCUINTPTR;
    587623/** Pointer to unsigned integer which can contain a HC pointer. */
    588 typedef const RTHCUINTPTR *PCRTHCUINTPTR;
     624typedef const RTHCUINTPTR  *PCRTHCUINTPTR;
     625/** Max RTHCUINTTPR value. */
     626#if HC_ARCH_BITS == 32
     627# define RTHCUINTPTR_MAX    UINT32_MAX
     628#else
     629# define RTHCUINTPTR_MAX    UINT64_MAX
     630#endif
    589631
    590632/** Unsigned integer which can contain a HC ring-3 pointer. */
    591633#if R3_ARCH_BITS == 32
    592 typedef uint32_t        RTR3UINTPTR;
     634typedef uint32_t            RTR3UINTPTR;
    593635#elif R3_ARCH_BITS == 64
    594 typedef uint64_t        RTR3UINTPTR;
    595 #else
    596 #  error Unsupported R3_ARCH_BITS value.
     636typedef uint64_t            RTR3UINTPTR;
     637#else
     638# error Unsupported R3_ARCH_BITS value.
    597639#endif
    598640/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
    599 typedef RTR3UINTPTR    *PRTR3UINTPTR;
     641typedef RTR3UINTPTR        *PRTR3UINTPTR;
    600642/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
    601 typedef const RTR3UINTPTR *PCRTR3UINTPTR;
     643typedef const RTR3UINTPTR  *PCRTR3UINTPTR;
     644/** Max RTHCUINTTPR value. */
     645#if R3_ARCH_BITS == 32
     646# define RTR3UINTPTR_MAX    UINT32_MAX
     647#else
     648# define RTR3UINTPTR_MAX    UINT64_MAX
     649#endif
    602650
    603651/** Unsigned integer which can contain a HC ring-0 pointer. */
    604652#if R0_ARCH_BITS == 32
    605 typedef uint32_t        RTR0UINTPTR;
     653typedef uint32_t            RTR0UINTPTR;
    606654#elif R0_ARCH_BITS == 64
    607 typedef uint64_t        RTR0UINTPTR;
    608 #else
    609 #  error Unsupported R0_ARCH_BITS value.
     655typedef uint64_t            RTR0UINTPTR;
     656#else
     657# error Unsupported R0_ARCH_BITS value.
    610658#endif
    611659/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
    612 typedef RTR0UINTPTR    *PRTR0UINTPTR;
     660typedef RTR0UINTPTR        *PRTR0UINTPTR;
    613661/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
    614 typedef const RTR0UINTPTR *PCRTR0UINTPTR;
     662typedef const RTR0UINTPTR  *PCRTR0UINTPTR;
     663/** Max RTR0UINTTPR value. */
     664#if HC_ARCH_BITS == 32
     665# define RTR0UINTPTR_MAX    UINT32_MAX
     666#else
     667# define RTR0UINTPTR_MAX    UINT64_MAX
     668#endif
    615669
    616670
    617671/** Host Physical Memory Address. */
    618 typedef uint64_t        RTHCPHYS;
     672typedef uint64_t            RTHCPHYS;
    619673/** Pointer to Host Physical Memory Address. */
    620 typedef RTHCPHYS       *PRTHCPHYS;
     674typedef RTHCPHYS           *PRTHCPHYS;
    621675/** Pointer to const Host Physical Memory Address. */
    622 typedef const RTHCPHYS *PCRTHCPHYS;
     676typedef const RTHCPHYS     *PCRTHCPHYS;
    623677/** @def NIL_RTHCPHYS
    624678 * NIL HC Physical Address.
     
    626680 * to the NULL pointer.
    627681 */
    628 #define NIL_RTHCPHYS     (~(RTHCPHYS)0)
     682#define NIL_RTHCPHYS        (~(RTHCPHYS)0)
     683/** Max RTHCPHYS value. */
     684#define RTHCPHYS_MAX        UINT64_MAX
    629685
    630686
    631687/** HC pointer. */
    632688#ifndef IN_RC
    633 typedef void *          RTHCPTR;
    634 #else
    635 typedef RTHCUINTPTR     RTHCPTR;
     689typedef void *              RTHCPTR;
     690#else
     691typedef RTHCUINTPTR         RTHCPTR;
    636692#endif
    637693/** Pointer to HC pointer. */
    638 typedef RTHCPTR        *PRTHCPTR;
     694typedef RTHCPTR            *PRTHCPTR;
    639695/** Pointer to const HC pointer. */
    640 typedef const RTHCPTR  *PCRTHCPTR;
     696typedef const RTHCPTR      *PCRTHCPTR;
    641697/** @def NIL_RTHCPTR
    642698 * NIL HC pointer.
    643699 */
    644 #define NIL_RTHCPTR     ((RTHCPTR)0)
     700#define NIL_RTHCPTR         ((RTHCPTR)0)
     701/** Max RTHCPTR value. */
     702#define RTHCPTR_MAX         ((RTHCPTR)RTHCUINTPTR_MAX)
     703
    645704
    646705/** HC ring-3 pointer. */
    647706#ifdef  IN_RING3
    648 typedef void *          RTR3PTR;
    649 #else
    650 typedef RTR3UINTPTR     RTR3PTR;
     707typedef void *              RTR3PTR;
     708#else
     709typedef RTR3UINTPTR         RTR3PTR;
    651710#endif
    652711/** Pointer to HC ring-3 pointer. */
    653 typedef RTR3PTR        *PRTR3PTR;
     712typedef RTR3PTR            *PRTR3PTR;
    654713/** Pointer to const HC ring-3 pointer. */
    655 typedef const RTR3PTR  *PCRTR3PTR;
     714typedef const RTR3PTR      *PCRTR3PTR;
    656715/** @def NIL_RTR3PTR
    657716 * NIL HC ring-3 pointer.
    658717 */
    659 #define NIL_RTR3PTR     ((RTR3PTR)0)
     718#define NIL_RTR3PTR         ((RTR3PTR)0)
     719/** Max RTR3PTR value. */
     720#define RTR3PTR_MAX         ((RTR3PTR)RTR3UINTPTR_MAX)
    660721
    661722/** HC ring-0 pointer. */
    662723#ifdef  IN_RING0
    663 typedef void *          RTR0PTR;
    664 #else
    665 typedef RTR0UINTPTR     RTR0PTR;
     724typedef void *              RTR0PTR;
     725#else
     726typedef RTR0UINTPTR         RTR0PTR;
    666727#endif
    667728/** Pointer to HC ring-0 pointer. */
    668 typedef RTR0PTR        *PRTR0PTR;
     729typedef RTR0PTR            *PRTR0PTR;
    669730/** Pointer to const HC ring-0 pointer. */
    670 typedef const RTR0PTR  *PCRTR0PTR;
     731typedef const RTR0PTR      *PCRTR0PTR;
    671732/** @def NIL_RTR0PTR
    672733 * NIL HC ring-0 pointer.
    673734 */
    674 #define NIL_RTR0PTR     ((RTR0PTR)0)
     735#define NIL_RTR0PTR         ((RTR0PTR)0)
     736/** Max RTR3PTR value. */
     737#define RTR0PTR_MAX         ((RTR0PTR)RTR0UINTPTR_MAX)
    675738
    676739
     
    789852
    790853/** Guest Physical Memory Address.*/
    791 typedef uint64_t        RTGCPHYS;
     854typedef uint64_t            RTGCPHYS;
    792855/** Pointer to Guest Physical Memory Address. */
    793 typedef RTGCPHYS       *PRTGCPHYS;
     856typedef RTGCPHYS           *PRTGCPHYS;
    794857/** Pointer to const Guest Physical Memory Address. */
    795 typedef const RTGCPHYS *PCRTGCPHYS;
     858typedef const RTGCPHYS     *PCRTGCPHYS;
    796859/** @def NIL_RTGCPHYS
    797860 * NIL GC Physical Address.
     
    800863 * some contexts.
    801864 */
    802 #define NIL_RTGCPHYS     (~(RTGCPHYS)0U)
     865#define NIL_RTGCPHYS        (~(RTGCPHYS)0U)
     866/** Max guest physical memory address value. */
     867#define RTGCPHYS_MAX        UINT64_MAX
    803868
    804869
    805870/** Guest Physical Memory Address; limited to 32 bits.*/
    806 typedef uint32_t        RTGCPHYS32;
     871typedef uint32_t            RTGCPHYS32;
    807872/** Pointer to Guest Physical Memory Address. */
    808 typedef RTGCPHYS32     *PRTGCPHYS32;
     873typedef RTGCPHYS32         *PRTGCPHYS32;
    809874/** Pointer to const Guest Physical Memory Address. */
    810 typedef const RTGCPHYS32 *PCRTGCPHYS32;
     875typedef const RTGCPHYS32    *PCRTGCPHYS32;
    811876/** @def NIL_RTGCPHYS32
    812877 * NIL GC Physical Address.
     
    867932typedef PRTGCPTR64      PRTGCPTR;
    868933/** Pointer to a const guest context pointer. */
    869 typedef PCRTGCPTR64    PCRTGCPTR;
     934typedef PCRTGCPTR64     PCRTGCPTR;
    870935/** @def NIL_RTGCPTR
    871936 * NIL GC pointer.
    872937 */
    873 #define NIL_RTGCPTR     NIL_RTGCPTR64
     938# define NIL_RTGCPTR    NIL_RTGCPTR64
     939/** Max RTGCPTR value. */
     940# define RTGCPTR_MAX    UINT64_MAX
    874941#elif GC_ARCH_BITS == 32
    875942typedef RTGCPTR32       RTGCPTR;
     
    877944typedef PRTGCPTR32      PRTGCPTR;
    878945/** Pointer to a const guest context pointer. */
    879 typedef PCRTGCPTR32    PCRTGCPTR;
     946typedef PCRTGCPTR32     PCRTGCPTR;
    880947/** @def NIL_RTGCPTR
    881948 * NIL GC pointer.
    882949 */
    883 #define NIL_RTGCPTR     NIL_RTGCPTR32
     950# define NIL_RTGCPTR     NIL_RTGCPTR32
     951/** Max RTGCPTR value. */
     952# define RTGCPTR_MAX    UINT32_MAX
    884953#else
    885954# error "Unsupported GC_ARCH_BITS!"
     
    900969
    901970#if GC_ARCH_BITS == 64
    902 typedef RTGCUINTREG64       RTGCUINTREG;
     971typedef RTGCUINTREG64           RTGCUINTREG;
    903972#elif GC_ARCH_BITS == 32
    904 typedef RTGCUINTREG32       RTGCUINTREG;
     973typedef RTGCUINTREG32           RTGCUINTREG;
    905974#else
    906975# error "Unsupported GC_ARCH_BITS!"
    907976#endif
    908977/** Pointer to an unsigned integer register in the guest context. */
    909 typedef RTGCUINTREG        *PRTGCUINTREG;
     978typedef RTGCUINTREG            *PRTGCUINTREG;
    910979/** Pointer to a const unsigned integer register in the guest context. */
    911 typedef const RTGCUINTREG  *PCRTGCUINTREG;
     980typedef const RTGCUINTREG      *PCRTGCUINTREG;
    912981
    913982/** @} */
Note: See TracChangeset for help on using the changeset viewer.

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