sc/source/core/opencl/op_math.cxx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
New commits: commit 87e4520fdb661309da732c25a7ad58c7efd52a90 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Sep 22 09:55:22 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Sep 22 18:01:17 2022 +0200 fix and simplify ocInt in opencl This is what core does, it also extends the range (the casting to int variant limited to the range of the int, which the core variant doesn't). Change-Id: Ib93bc57b38c0927f9732742d116d0f40700a0abb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140394 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 481e5d14c6a4..1bf3e231b4a2 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -222,20 +222,13 @@ void OpInt::BinInlineFun(std::set<std::string>& decls, { decls.insert(is_representable_integerDecl); funs.insert(is_representable_integer); - decls.insert(approx_equalDecl); - funs.insert(approx_equal); + decls.insert(value_approxDecl); + funs.insert(value_approx); } void OpInt::GenerateCode( outputstream& ss ) const { - ss << " int intTmp = (int)arg0;\n"; - // check whether rounding error caused the float to be just less than the int value - ss << " if( arg0 >=0 && approx_equal( intTmp + 1, arg0 ))\n"; - ss << " ++intTmp;\n"; - // negative values are rounded down - ss << " if( arg0 < 0 && !approx_equal( intTmp, arg0 ))\n"; - ss << " --intTmp;\n"; - ss << " return intTmp;\n"; + ss << " return floor( value_approx( arg0 ));\n"; } void OpNegSub::GenerateCode( outputstream& ss ) const