sc/source/core/opencl/op_math.cxx |   27 ---------------------------
 sc/source/core/opencl/op_math.hxx |   14 +++++---------
 2 files changed, 5 insertions(+), 36 deletions(-)

New commits:
commit 799bde0490f2bcd0562e2c9a8d08709b472417b2
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Sep 22 09:55:18 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Thu Sep 22 18:00:51 2022 +0200

    make ocTrunc and ocRoundDown the same in opencl
    
    It's that way in core too.
    
    Change-Id: Ic1100ed637a310b8073256b95a261023b32df827
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140373
    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 5e88f8f67a8e..481e5d14c6a4 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -1169,33 +1169,6 @@ void OpSumIf::GenSlidingWindowFunction(outputstream &ss,
     ss << "}";
 }
 
-void OpTrunc::GenSlidingWindowFunction(outputstream &ss,
-            const std::string &sSymName, SubArguments &vSubArguments)
-{
-    CHECK_PARAMETER_COUNT( 1, 2 );
-    GenerateFunctionDeclaration( sSymName, vSubArguments, ss );
-    ss << "{\n";
-    ss << "    int gid0=get_global_id(0);\n";
-    GenerateArg( "arg0", 0, vSubArguments, ss );
-    GenerateArgWithDefault( "arg1", 1, 0, vSubArguments, ss );
-    ss << "    double argm = arg0;\n";
-    ss << "    int n = (int)arg1;\n";
-    ss << "    double nn = 1.0f;\n";
-    ss << "    for(int i = 0; i < n; ++i)\n";
-    ss << "    {\n";
-    ss << "        argm = argm * 10;\n";
-    ss << "        nn = nn * 10;\n";
-    ss << "    }\n";
-    ss << "    for(int i = 0; i > n; --i)\n";
-    ss << "    {\n";
-    ss << "        argm = argm / 10;\n";
-    ss << "        nn = nn / 10;\n";
-    ss << "    }\n";
-    ss << "    modf(argm, &argm);\n";
-    ss << "    return argm / nn;\n";
-    ss << "}\n";
-}
-
 void OpFloor::GenSlidingWindowFunction(
     outputstream &ss, const std::string &sSymName,
     SubArguments &vSubArguments)
diff --git a/sc/source/core/opencl/op_math.hxx 
b/sc/source/core/opencl/op_math.hxx
index a5adec2cb8aa..8ffe1ee779e5 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -177,15 +177,6 @@ public:
     virtual void GenerateCode( outputstream& ss ) const override;
 };
 
-class OpTrunc: public Normal
-{
-public:
-    virtual void GenSlidingWindowFunction(outputstream &ss,
-            const std::string &sSymName, SubArguments &vSubArguments) override;
-
-    virtual std::string BinFuncName() const override { return "Trunc"; }
-};
-
 class OpArcTan2 : public OpMathTwoArguments
 {
 public:
@@ -272,6 +263,11 @@ public:
             const std::string &sSymName, SubArguments &vSubArguments) override;
     virtual std::string BinFuncName() const override { return "RoundDown"; }
 };
+class OpTrunc: public OpRoundDown
+{
+public:
+    virtual std::string BinFuncName() const override { return "Trunc"; }
+};
 class OpInt: public OpMathOneArgument
 {
 public:

Reply via email to