diff options
-rw-r--r-- | include/rtl/math.hxx | 14 | ||||
-rw-r--r-- | sc/source/filter/excel/xlchart.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/excel/xltools.cxx | 13 |
3 files changed, 7 insertions, 23 deletions
diff --git a/include/rtl/math.hxx b/include/rtl/math.hxx index 661ddf1d131d..604cefcb6b2c 100644 --- a/include/rtl/math.hxx +++ b/include/rtl/math.hxx @@ -431,28 +431,18 @@ inline bool isSignBitSet(double d) */ inline void setInf(double * pd, bool bNegative) { - union - { - double sd; - sal_math_Double md; - }; + sal_math_Double& md = *reinterpret_cast<sal_math_Double*>(pd); md.w32_parts.msw = bNegative ? 0xFFF00000 : 0x7FF00000; md.w32_parts.lsw = 0; - *pd = sd; } /** Set a QNAN. */ inline void setNan(double * pd) { - union - { - double sd; - sal_math_Double md; - }; + sal_math_Double& md = *reinterpret_cast<sal_math_Double*>(pd); md.w32_parts.msw = 0x7FFFFFFF; md.w32_parts.lsw = 0xFFFFFFFF; - *pd = sd; } /** If a value is a valid argument for sin(), cos(), tan(). diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index 011d4578ff6f..c916b9d7dfbd 100644 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -197,8 +197,7 @@ XclChSerTrendLine::XclChSerTrendLine() : /* Set all bits in mfIntercept to 1 (that is -1.#NAN) to indicate that there is no interception point. Cannot use ::rtl::math::setNan() here cause it misses the sign bit. */ - sal_math_Double* pDouble = reinterpret_cast< sal_math_Double* >( &mfIntercept ); - pDouble->w32_parts.msw = pDouble->w32_parts.lsw = 0xFFFFFFFF; + reinterpret_cast<sal_math_Double*>(&mfIntercept)->intrep = 0xFFFFFFFFFFFFFFFF; } XclChSerErrorBar::XclChSerErrorBar() : diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 3a69e7da06a7..35ef279161cb 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -97,18 +97,13 @@ const XclGuid XclTools::maGuidFileMoniker( double XclTools::GetDoubleFromRK( sal_Int32 nRKValue ) { - union - { - double fVal; - sal_math_Double smD; - }; - fVal = 0.0; + sal_math_Double smD{}; if( ::get_flag( nRKValue, EXC_RK_INTFLAG ) ) { sal_Int32 nTemp = nRKValue >> 2; ::set_flag< sal_Int32 >( nTemp, 0xE0000000, nRKValue < 0 ); - fVal = nTemp; + smD.value = nTemp; } else { @@ -116,9 +111,9 @@ double XclTools::GetDoubleFromRK( sal_Int32 nRKValue ) } if( ::get_flag( nRKValue, EXC_RK_100FLAG ) ) - fVal /= 100.0; + smD.value /= 100.0; - return fVal; + return smD.value; } bool XclTools::GetRKFromDouble( sal_Int32& rnRKValue, double fValue ) |