VirtualBox

Changeset 96197 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Aug 14, 2022 1:04:34 AM (2 years ago)
Author:
vboxsync
Message:

IPRT/math.h: Define our own set of classification flags so we can test fpclassify[dfl] in IPRT_NOCRT_WITHOUT_MATH_CONSTANTS mode. bugref:10261

Location:
trunk/src/VBox/Runtime/common/math
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/math/__fpclassifyd.cpp

    r96093 r96197  
    4343    u.rd = rd;
    4444    if (RTFLOAT64U_IS_ZERO(&u))
    45         return FP_ZERO;
     45        return RT_NOCRT_FP_ZERO;
    4646    if (RTFLOAT64U_IS_NORMAL(&u))
    47         return FP_NORMAL;
     47        return RT_NOCRT_FP_NORMAL;
    4848    if (RTFLOAT64U_IS_NAN(&u))
    49         return FP_NAN;
     49        return RT_NOCRT_FP_NAN;
    5050    if (RTFLOAT64U_IS_INF(&u))
    51         return FP_INFINITE;
     51        return RT_NOCRT_FP_INFINITE;
    5252    Assert(RTFLOAT64U_IS_SUBNORMAL(&u));
    53     return FP_SUBNORMAL;
     53    return RT_NOCRT_FP_SUBNORMAL;
    5454}
    5555RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL_WITHOUT_UNDERSCORE(__fpclassifyd);
  • trunk/src/VBox/Runtime/common/math/__fpclassifyf.cpp

    r96093 r96197  
    4343    u.r = r32;
    4444    if (RTFLOAT32U_IS_ZERO(&u))
    45         return FP_ZERO;
     45        return RT_NOCRT_FP_ZERO;
    4646    if (RTFLOAT32U_IS_NORMAL(&u))
    47         return FP_NORMAL;
     47        return RT_NOCRT_FP_NORMAL;
    4848    if (RTFLOAT32U_IS_NAN(&u))
    49         return FP_NAN;
     49        return RT_NOCRT_FP_NAN;
    5050    if (RTFLOAT32U_IS_INF(&u))
    51         return FP_INFINITE;
     51        return RT_NOCRT_FP_INFINITE;
    5252    Assert(RTFLOAT32U_IS_SUBNORMAL(&u));
    53     return FP_SUBNORMAL;
     53    return RT_NOCRT_FP_SUBNORMAL;
    5454}
    5555RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL_WITHOUT_UNDERSCORE(__fpclassifyf);
  • trunk/src/VBox/Runtime/common/math/__fpclassifyl.cpp

    r96093 r96197  
    3939int RT_NOCRT(__fpclassifyl)(long double lrd)
    4040{
    41 #ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
    42     AssertCompile(sizeof(lrd) == sizeof(uint64_t));
     41#ifdef RT_COMPILER_WITH_128BIT_LONG_DOUBLE
     42    RTFLOAT128U u;
     43    u.rd = lrd;
     44    if (RTFLOAT128U_IS_ZERO(&u))
     45        return RT_NOCRT_FP_ZERO;
     46    if (RTFLOAT128U_IS_NORMAL(&u))
     47        return RT_NOCRT_FP_NORMAL;
     48    if (RTFLOAT128U_IS_NAN(&u))
     49        return RT_NOCRT_FP_NAN;
     50    if (RTFLOAT128U_IS_INF(&u))
     51        return RT_NOCRT_FP_INFINITE;
     52    Assert(RTFLOAT128U_IS_SUBNORMAL(&u));
     53    return RT_NOCRT_FP_SUBNORMAL;
     54
     55#elif defined(RT_COMPILER_WITH_80BIT_LONG_DOUBLE)
    4356    RTFLOAT80U2 u;
    4457    u.lrd = lrd;
    4558    if (RTFLOAT80U_IS_ZERO(&u))
    46         return FP_ZERO;
     59        return RT_NOCRT_FP_ZERO;
    4760    if (RTFLOAT80U_IS_NORMAL(&u))
    48         return FP_NORMAL;
     61        return RT_NOCRT_FP_NORMAL;
    4962    if (RTFLOAT80U_IS_NAN(&u))
    50         return FP_NAN;
     63        return RT_NOCRT_FP_NAN;
    5164    if (RTFLOAT80U_IS_INF(&u))
    52         return FP_INFINITE;
     65        return RT_NOCRT_FP_INFINITE;
    5366    if (RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL(&u))
    54         return FP_SUBNORMAL;
     67        return RT_NOCRT_FP_SUBNORMAL;
    5568
    5669    /* Following i387 invalid operand rules here.  Adjust as needed for
    5770       other architectures. */
    5871    Assert(RTFLOAT80U_IS_387_INVALID(&u));
    59     return FP_NAN;
     72    return RT_NOCRT_FP_NAN;
    6073
    6174#else
     
    6477    u.rd = lrd;
    6578    if (RTFLOAT64U_IS_ZERO(&u))
    66         return FP_ZERO;
     79        return RT_NOCRT_FP_ZERO;
    6780    if (RTFLOAT64U_IS_NORMAL(&u))
    68         return FP_NORMAL;
     81        return RT_NOCRT_FP_NORMAL;
    6982    if (RTFLOAT64U_IS_NAN(&u))
    70         return FP_NAN;
     83        return RT_NOCRT_FP_NAN;
    7184    if (RTFLOAT64U_IS_INF(&u))
    72         return FP_INFINITE;
     85        return RT_NOCRT_FP_INFINITE;
    7386    Assert(RTFLOAT64U_IS_SUBNORMAL(&u));
    74     return FP_SUBNORMAL;
     87    return RT_NOCRT_FP_SUBNORMAL;
    7588#endif
    7689}
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