VirtualBox

Changeset 94336 in vbox


Ignore:
Timestamp:
Mar 23, 2022 1:59:05 PM (3 years ago)
Author:
vboxsync
Message:

IPRT: RTStrFormatR80/64/32 corrections. bugref:9898

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/strformatfloat.cpp

    r94302 r94336  
    6969    if (RTFLOAT32U_IS_ZERO(pr32Value))
    7070        return fSign
    71              ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0"))
    72              : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0"));
     71             ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0"))
     72             : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0"));
    7373    if (RTFLOAT32U_IS_INF(pr32Value))
    7474        return fSign
    75              ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf"))
    76              : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf"));
     75             ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf"))
     76             : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf"));
    7777
    7878    /*
     
    151151    if (RTFLOAT64U_IS_ZERO(pr64Value))
    152152        return fSign
    153              ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0"))
    154              : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0"));
     153             ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0"))
     154             : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0"));
    155155    if (RTFLOAT64U_IS_INF(pr64Value))
    156156        return fSign
    157              ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf"))
    158              : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf"));
     157             ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf"))
     158             : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf"));
    159159
    160160    /*
     
    247247            && !fInteger)
    248248            return fSign
    249                  ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0"))
    250                  : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0"));
     249                 ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-0"))
     250                 : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+0"));
    251251        fDenormal = true;
    252252    }
     
    257257            if (!uFraction)
    258258                return fSign
    259                      ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+PseudoInf"))
    260                      : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-PseudoInf"));
     259                     ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-PseudoInf"))
     260                     : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+PseudoInf"));
    261261            if (!(fFlags & RTSTR_F_SPECIAL))
    262262                return fSign
    263                      ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+PseudoNan"))
    264                      : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-PseudoNan"));
     263                     ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-PseudoNan"))
     264                     : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+PseudoNan"));
    265265            pszTmp = (char *)memcpy(pszTmp, "PseudoNan[", 10) + 10;
    266266        }
     
    269269            if (!(uFraction & (RT_BIT_64(62) - 1)))
    270270                return fSign
    271                      ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf"))
    272                      : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf"));
     271                     ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Inf"))
     272                     : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Inf"));
    273273            if (!(fFlags & RTSTR_F_SPECIAL))
    274274                return rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("SNan"));
     
    279279            if (!(uFraction & (RT_BIT_64(62) - 1)))
    280280                return fSign
    281                      ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Ind"))
    282                      : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Ind"));
     281                     ? rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("-Ind"))
     282                     : rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("+Ind"));
    283283            if (!(fFlags & RTSTR_F_SPECIAL))
    284284                return rtStrFormatCopyOutStr(pszBuf, cbBuf, RT_STR_TUPLE("QNan"));
     
    302302    pszTmp += RTStrFormatNumber(pszTmp, (int32_t)uExponent - RTFLOAT80U_EXP_BIAS, 10, 0, 0,
    303303                                RTSTR_F_ZEROPAD | RTSTR_F_32BIT | RTSTR_F_VALSIGNED);
    304     if (fDenormal && (fFlags & RTSTR_F_SPECIAL))
    305     {
    306         if (fInteger)
    307             pszTmp = (char *)memcpy(pszTmp, "[PDn]", 5) + 5;
    308         else
    309             pszTmp = (char *)memcpy(pszTmp, "[Den]", 5) + 5;
     304    if (fFlags & RTSTR_F_SPECIAL)
     305    {
     306        if (fDenormal)
     307        {
     308            if (fInteger)
     309                pszTmp = (char *)memcpy(pszTmp, "[PDn]", 5) + 5;
     310            else
     311                pszTmp = (char *)memcpy(pszTmp, "[Den]", 5) + 5;
     312        }
     313        else if (!fInteger)
     314            pszTmp = (char *)memcpy(pszTmp, "[Unn]", 5) + 5;
    310315    }
    311316    return rtStrFormatCopyOutStr(pszBuf, cbBuf, szTmp, pszTmp - &szTmp[0]);
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