VirtualBox

Changeset 35511 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jan 12, 2011 5:50:00 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69394
Message:

iprt/types.h: Added RTFLOAT64U, RTFLOAT80U and RTFLOAT80U2.

File:
1 edited

Legend:

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

    r35182 r35511  
    427427
    428428
     429/**
     430 * Double precision floating point format (64-bit).
     431 */
     432typedef union RTFLOAT64U
     433{
     434#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     435    /** Double view. */
     436    double      rd;
     437#endif
     438    /** Format using regular bitfields.  */
     439    struct
     440    {
     441# ifdef RT_BIG_ENDIAN
     442        /** The sign indicator. */
     443        uint32_t    fSign : 1;
     444        /** The exponent (offseted by 1023). */
     445        uint32_t    uExponent : 11;
     446        /** The fraction, bits 32 thru 51. */
     447        uint32_t    u20FractionHigh : 20;
     448        /** The fraction, bits 0 thru 31. */
     449        uint32_t    u32FractionLow;
     450# else
     451        /** The fraction, bits 0 thru 31. */
     452        uint32_t    u32FractionLow;
     453        /** The fraction, bits 32 thru 51. */
     454        uint32_t    u20FractionHigh : 20;
     455        /** The exponent (offseted by 1023). */
     456        uint32_t    uExponent : 11;
     457        /** The sign indicator. */
     458        uint32_t    fSign : 1;
     459# endif
     460    } s;
     461
     462#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
     463    /** Format using 64-bit bitfields.  */
     464    struct
     465    {
     466# ifdef RT_BIG_ENDIAN
     467        /** The sign indicator. */
     468        RT_GCC_EXTENSION uint64_t    fSign : 1;
     469        /** The exponent (offseted by 1023). */
     470        RT_GCC_EXTENSION uint64_t    uExponent : 11;
     471        /** The fraction. */
     472        RT_GCC_EXTENSION uint64_t    uFraction : 52;
     473# else
     474        /** The fraction. */
     475        RT_GCC_EXTENSION uint64_t    uFraction : 52;
     476        /** The exponent (offseted by 1023). */
     477        RT_GCC_EXTENSION uint64_t    uExponent : 11;
     478        /** The sign indicator. */
     479        RT_GCC_EXTENSION uint64_t    fSign : 1;
     480# endif
     481    } s64;
     482#endif
     483
     484    /** 64-bit view. */
     485    uint64_t    au64[1];
     486    /** 32-bit view. */
     487    uint32_t    au32[2];
     488    /** 16-bit view. */
     489    uint16_t    au16[4];
     490    /** 8-bit view. */
     491    uint8_t     au8[8];
     492} RTFLOAT64U;
     493/** Pointer to a double precision floating point format union. */
     494typedef RTFLOAT64U *PRTFLOAT64U;
     495/** Pointer to a const double precision floating point format union. */
     496typedef const RTFLOAT64U *PCRTFLOAT64U;
     497
     498
     499/**
     500 * Extended Double precision floating point format (80-bit).
     501 */
     502#pragma pack(1)
     503typedef union RTFLOAT80U
     504{
     505    /** Format using bitfields.  */
     506    struct
     507    {
     508# ifdef RT_BIG_ENDIAN
     509        /** The sign indicator. */
     510        RT_GCC_EXTENSION uint16_t   fSign : 1;
     511        /** The exponent (offseted by 16383). */
     512        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     513        /** The fraction. */
     514        uint64_t                    u64Fraction;
     515# else
     516        /** The fraction. */
     517        uint64_t                    u64Fraction;
     518        /** The exponent (offseted by 16383). */
     519        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     520        /** The sign indicator. */
     521        RT_GCC_EXTENSION uint16_t   fSign : 1;
     522# endif
     523    } s;
     524
     525    /** 64-bit view. */
     526    uint64_t    au64[1];
     527    /** 32-bit view. */
     528    uint32_t    au32[2];
     529    /** 16-bit view. */
     530    uint16_t    au16[5];
     531    /** 8-bit view. */
     532    uint8_t     au8[10];
     533} RTFLOAT80U;
     534#pragma pack()
     535/** Pointer to a extended precision floating point format union. */
     536typedef RTFLOAT80U *PRTFLOAT80U;
     537/** Pointer to a const extended precision floating point format union. */
     538typedef const RTFLOAT80U *PCRTFLOAT80U;
     539
     540
     541/**
     542 * A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
     543 * compiler implements long double.
     544 */
     545#pragma pack(1)
     546typedef union RTFLOAT80U2
     547{
     548#ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
     549    /** Long double view. */
     550    long double     lrd;
     551#endif
     552    /** Format using bitfields.  */
     553    struct
     554    {
     555#ifdef RT_BIG_ENDIAN
     556        /** The sign indicator. */
     557        RT_GCC_EXTENSION uint16_t   fSign : 1;
     558        /** The exponent (offseted by 16383). */
     559        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     560        /** The fraction. */
     561        uint64_t                    u64Mantissa;
     562#else
     563        /** The fraction. */
     564        uint64_t                    u64Mantissa;
     565        /** The exponent (offseted by 16383). */
     566        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     567        /** The sign indicator. */
     568        RT_GCC_EXTENSION uint16_t   fSign : 1;
     569#endif
     570    } s;
     571
     572    /** Bitfield exposing the J bit and the fraction.  */
     573    struct
     574    {
     575#ifdef RT_BIG_ENDIAN
     576        /** The sign indicator. */
     577        RT_GCC_EXTENSION uint16_t   fSign : 1;
     578        /** The exponent (offseted by 16383). */
     579        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     580        /** The J bit, aka the integer bit. */
     581        uint32_t                    fInteger;
     582        /** The fraction, bits 32 thru 62. */
     583        uint32_t                    u31FractionHigh : 31;
     584        /** The fraction, bits 0 thru 31. */
     585        uint32_t                    u32FractionLow : 32;
     586#else
     587        /** The fraction, bits 0 thru 31. */
     588        uint32_t                    u32FractionLow : 32;
     589        /** The fraction, bits 32 thru 62. */
     590        uint32_t                    u31FractionHigh : 31;
     591        /** The J bit, aka the integer bit. */
     592        uint32_t                    fInteger;
     593        /** The exponent (offseted by 16383). */
     594        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     595        /** The sign indicator. */
     596        RT_GCC_EXTENSION uint16_t   fSign : 1;
     597#endif
     598    } sj;
     599
     600#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
     601    /** 64-bit bitfields exposing the J bit and the fraction.  */
     602    struct
     603    {
     604# ifdef RT_BIG_ENDIAN
     605        /** The sign indicator. */
     606        RT_GCC_EXTENSION uint16_t   fSign : 1;
     607        /** The exponent (offseted by 16383). */
     608        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     609        /** The J bit, aka the integer bit. */
     610        RT_GCC_EXTENSION uint64_t   fInteger : 1;
     611        /** The fraction. */
     612        RT_GCC_EXTENSION uint64_t   u63Fraction : 63;
     613# else
     614        /** The fraction. */
     615        RT_GCC_EXTENSION uint64_t   u63Fraction : 63;
     616        /** The J bit, aka the integer bit. */
     617        RT_GCC_EXTENSION uint64_t   fInteger : 1;
     618        /** The exponent (offseted by 16383). */
     619        RT_GCC_EXTENSION uint16_t   uExponent : 15;
     620        /** The sign indicator. */
     621        RT_GCC_EXTENSION uint16_t   fSign : 1;
     622# endif
     623    } sj64;
     624#endif
     625
     626    /** 64-bit view. */
     627    uint64_t    au64[1];
     628    /** 32-bit view. */
     629    uint32_t    au32[2];
     630    /** 16-bit view. */
     631    uint16_t    au16[5];
     632    /** 8-bit view. */
     633    uint8_t     au8[10];
     634} RTFLOAT80U2;
     635#pragma pack()
     636/** Pointer to a extended precision floating point format union, 2nd
     637 * variant. */
     638typedef RTFLOAT80U2 *PRTFLOAT80U2;
     639/** Pointer to a const extended precision floating point format union, 2nd
     640 * variant. */
     641typedef const RTFLOAT80U2 *PCRTFLOAT80U2;
     642
     643
    429644/** Generic function type.
    430645 * @see PFNRT
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