[Libreoffice-commits] core.git: stoc/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 13 15:23:45 UTC 2019


 stoc/source/typeconv/convert.cxx |   29 ++++-------------------------
 1 file changed, 4 insertions(+), 25 deletions(-)

New commits:
commit 63128dd267eb2d487c94ba8db65444a3e5e69fd2
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Aug 13 14:50:30 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Aug 13 17:23:03 2019 +0200

    Drop MSVC workaround from 2002
    
    (cf. f2b0299972730989c46949d6101c7c346fc01971 "#97095# MS Visual C++ unsigned
    __int64 to double missing"), assuming that our baseline MSVC is capable of that
    by now.
    
    Replace DOUBLE_SAL_UINT64_MAX with double(SAL_MAX_UINT64) and replace
    unsigned_int64_to_double(X) with either X or static_cast<double>(X), matching
    respective context.
    
    Change-Id: Ia1e1daff5cbcb545738615fad541082810d7a46b
    Reviewed-on: https://gerrit.libreoffice.org/77414
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index 9ec909310b02..9ffef7287d6c 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -51,27 +51,6 @@ using namespace osl;
 namespace stoc_tcv
 {
 
-/* MS Visual C++ no conversion from unsigned __int64 to double */
-#ifdef _MSC_VER
-static const double DOUBLE_SAL_UINT64_MAX = ((double(SAL_MAX_INT64)) * 2) + 1;
-
-static double unsigned_int64_to_double( sal_uInt64 n )
-{
-    sal_uInt64 n2 = n / 3;
-    n -= (2 * n2);
-    return (static_cast<double>(static_cast<sal_Int64>(n2)) * 2.0) + static_cast<double>(static_cast<sal_Int64>(n));
-}
-#else
-static const double DOUBLE_SAL_UINT64_MAX =
-    double(((sal_uInt64(0xffffffff)) << 32) | sal_uInt64(0xffffffff));
-
-static double unsigned_int64_to_double( sal_uInt64 n )
-{
-    return static_cast<double>(n);
-}
-#endif
-
-
 static double round( double aVal )
 {
     bool bPos   = (aVal >= 0.0);
@@ -221,7 +200,7 @@ static bool getHyperValue( sal_Int64 & rnVal, const OUString & rStr )
     double fVal;
     if (getNumericValue( fVal, rStr ) &&
         fVal >= double(SAL_MIN_INT64) &&
-        fVal <= DOUBLE_SAL_UINT64_MAX)
+        fVal <= double(SAL_MAX_UINT64))
     {
         rnVal = static_cast<sal_Int64>(round( fVal ));
         return true;
@@ -335,7 +314,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6
     {
         double fVal = round( *o3tl::forceAccess<float>(rAny) );
         nRet = (fVal > SAL_MAX_INT64 ? static_cast<sal_Int64>(static_cast<sal_uInt64>(fVal)) : static_cast<sal_Int64>(fVal));
-        if (fVal >= min && fVal <= unsigned_int64_to_double( max ))
+        if (fVal >= min && fVal <= max)
         {
             return nRet;
         }
@@ -347,7 +326,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6
     {
         double fVal = round( *o3tl::forceAccess<double>(rAny) );
         nRet = (fVal > SAL_MAX_INT64 ? static_cast<sal_Int64>(static_cast<sal_uInt64>(fVal)) : static_cast<sal_Int64>(fVal));
-        if (fVal >= min && fVal <= unsigned_int64_to_double( max ))
+        if (fVal >= min && fVal <= max)
         {
             return nRet;
         }
@@ -432,7 +411,7 @@ double TypeConverter_Impl::toDouble( const Any& rAny, double min, double max )
         break;
     // UNSIGNED HYPER
     case TypeClass_UNSIGNED_HYPER:
-        fRet = unsigned_int64_to_double( *o3tl::forceAccess<sal_uInt64>(rAny) );
+        fRet = static_cast<double>(*o3tl::forceAccess<sal_uInt64>(rAny));
         break;
     // FLOAT, DOUBLE
     case TypeClass_FLOAT:


More information about the Libreoffice-commits mailing list