Kaydet (Commit) 3db1e9ed authored tarafından Arnaud Versini's avatar Arnaud Versini Kaydeden (comit) Julien Nabet

BASIC : remove ImpRound and use std::(l)lround instead

Change-Id: I1e8f58890395bc6bc29f56c258836db3dc52384c
Reviewed-on: https://gerrit.libreoffice.org/30464Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 4bcf1872
......@@ -21,6 +21,8 @@
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
#include <cmath>
sal_uInt8 ImpGetByte( const SbxValues* p )
{
SbxValues aTmp;
......@@ -121,7 +123,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
}
else
nRes = (sal_uInt8) ImpRound( p->nSingle );
nRes = (sal_uInt8) std::lround( p->nSingle );
break;
case SbxDATE:
case SbxDOUBLE:
......@@ -147,7 +149,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
}
else
nRes = (sal_uInt8) ImpRound( dVal );
nRes = (sal_uInt8) std::lround( dVal );
break;
}
case SbxBYREF | SbxSTRING:
......
......@@ -21,6 +21,8 @@
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
#include <cmath>
sal_Unicode ImpGetChar( const SbxValues* p )
{
SbxValues aTmp;
......@@ -109,7 +111,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINCHAR;
}
else
nRes = (sal_Unicode) ImpRound( p->nSingle );
nRes = (sal_Unicode) std::lround( p->nSingle );
break;
case SbxDATE:
case SbxDOUBLE:
......@@ -135,7 +137,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINCHAR;
}
else
nRes = (sal_uInt8) ImpRound( dVal );
nRes = (sal_uInt8) std::lround( dVal );
break;
}
case SbxBYREF | SbxSTRING:
......@@ -156,7 +158,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINCHAR;
}
else
nRes = (sal_Unicode) ImpRound( d );
nRes = (sal_Unicode) std::lround( d );
}
break;
case SbxOBJECT:
......
......@@ -37,8 +37,7 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep );
// SBXINT.CXX
double ImpRound( double );
sal_Int16 ImpGetInteger( const SbxValues* );
sal_Int16 ImpGetInteger( const SbxValues* );
void ImpPutInteger( SbxValues*, sal_Int16 );
sal_Int64 ImpGetInt64( const SbxValues* );
......
......@@ -21,10 +21,7 @@
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
double ImpRound( double d )
{
return d + ( d < 0 ? -0.5 : 0.5 );
}
#include <cmath>
sal_Int16 ImpGetInteger( const SbxValues* p )
{
......@@ -84,7 +81,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMININT;
}
else
nRes = (sal_Int16) ImpRound( p->nSingle );
nRes = (sal_Int16) std::lround( p->nSingle );
break;
case SbxCURRENCY:
{
......@@ -145,7 +142,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMININT;
}
else
nRes = (sal_Int16) ImpRound( dVal );
nRes = (sal_Int16) std::lround( dVal );
break;
}
case SbxLPSTR:
......@@ -168,7 +165,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMININT;
}
else
nRes = (sal_Int16) ImpRound( d );
nRes = (sal_Int16) std::lround( d );
}
break;
case SbxOBJECT:
......@@ -350,7 +347,7 @@ sal_Int64 ImpDoubleToSalInt64( double d )
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINSALINT64;
}
else
nRes = (sal_Int64) ImpRound( d );
nRes = (sal_Int64) std::llround( d );
return nRes;
}
......@@ -366,7 +363,7 @@ sal_uInt64 ImpDoubleToSalUInt64( double d )
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
}
else
nRes = (sal_uInt64) ImpRound( d );
nRes = (sal_uInt64) std::llround( d );
return nRes;
}
......@@ -716,7 +713,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = 0;
}
else
nRes = (sal_uInt64) ImpRound( d );
nRes = (sal_uInt64) std::llround( d );
}
else if( n64 < 0 )
{
......
......@@ -21,6 +21,8 @@
#include <basic/sbx.hxx>
#include "sbxconv.hxx"
#include <cmath>
sal_Int32 ImpGetLong( const SbxValues* p )
{
SbxValues aTmp;
......@@ -63,7 +65,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINLNG;
}
else
nRes = (sal_Int32) ImpRound( p->nSingle );
nRes = (sal_Int32) std::lround( p->nSingle );
break;
case SbxSALINT64:
nRes = p->nInt64;
......@@ -104,7 +106,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINLNG;
}
else
nRes = (sal_Int32) ImpRound( dVal );
nRes = (sal_Int32) std::lround( dVal );
break;
}
case SbxBYREF | SbxSTRING:
......@@ -127,7 +129,7 @@ start:
SbxBase::SetError( ERRCODE_SBX_OVERFLOW ); nRes = SbxMINLNG;
}
else
nRes = (sal_Int32) ImpRound( d );
nRes = (sal_Int32) std::lround( d );
}
break;
case SbxOBJECT:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment