sc/source/core/opencl/formulagroupcl.cxx |    9 ----
 sc/source/core/opencl/op_math.cxx        |   66 -------------------------------
 sc/source/core/opencl/op_math.hxx        |    9 ----
 3 files changed, 1 insertion(+), 83 deletions(-)

New commits:
commit 067610f46ae57f88439a1b7c5a28209d129e641e
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Aug 30 15:48:56 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Aug 31 09:13:54 2022 +0200

    do not accept strings for opencl equal operator
    
    This is part of "using string hashes for strings is kind of stupid"
    removal. And it seems this is never used for all of Calc's tests.
    Just keep it for numeric comparison.
    
    Change-Id: I1c5e3b10c9cacf3d163a675373f14d879a857db8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139052
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index 6855434d37b7..9ab5b83057e9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -93,7 +93,6 @@ const char* const publicFunc =
  "double legalize(double a, double b) { return isnan(a)?b:a;}\n"
  "double fsub(double a, double b) { return a-b; }\n"
  "double fdiv(double a, double b) { return a/b; }\n"
- "double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n"
  "int is_representable_integer(double a) {\n"
  "    long kMaxInt = (1L << 53) - 1;\n"
  "    if (a <= as_double(kMaxInt))\n"
@@ -1787,11 +1786,10 @@ public:
     virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) 
const override
     {
         std::stringstream ss;
-        ss << "strequal(" << lhs << "," << rhs << ")";
+        ss << "(" << lhs << " == " << rhs << ")";
         return ss.str();
     }
     virtual std::string BinFuncName() const override { return "eq"; }
-    virtual bool takeString() const override { return true; }
 };
 
 class OpLessEqual : public Binary
commit 975fa7d700d50d376090de6c370aa00b8b38e8cf
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Aug 30 15:48:40 2022 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Aug 31 09:13:37 2022 +0200

    remove opencl implementation of CONVERT()
    
    Part of removal of string handling in opencl (using the hash here
    is not that bad, a hash collision is unlikely, but still).
    And the code handles only two conversions (m<->km and sec<->min ?
    I'm not even sure). And it seems it's not used a single time
    for all of Calc's checks.
    It could be added back if there's use for it (possibly with handling
    the strings better, e.g. by converting them in the C++ code
    to enumeration values passed to opencl).
    
    Change-Id: I65a6ab51d8fb42c09d8a76a1e09f6f5fcbae099a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139051
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/opencl/formulagroupcl.cxx 
b/sc/source/core/opencl/formulagroupcl.cxx
index b30fa97f854f..6855434d37b7 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3771,11 +3771,6 @@ 
DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config,
                     mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i],
                             std::make_shared<OpSqrtPi>(), nResultSize));
                 }
-                else if (pChild->GetExternal() == 
"com.sun.star.sheet.addin.Analysis.getConvert")
-                {
-                    mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i],
-                            std::make_shared<OpConvert>(), nResultSize));
-                }
                 else if (pChild->GetExternal() == 
"com.sun.star.sheet.addin.Analysis.getIseven")
                 {
                     mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, 
ft->Children[i],
diff --git a/sc/source/core/opencl/op_math.cxx 
b/sc/source/core/opencl/op_math.cxx
index 4042e2511177..5914436ffd8e 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -2642,72 +2642,6 @@ void 
OpCombin::GenSlidingWindowFunction(std::stringstream &ss,
     ss << "    return result;\n";
     ss << "}\n";
 }
-void OpConvert::GenSlidingWindowFunction(
-    std::stringstream &ss, const std::string &sSymName,
-    SubArguments &vSubArguments)
-{
-    // The CONVERT function converts a value from one unit of
-    // measurement to another. It takes the units of measurements to
-    // convert between as string arguments. This implementation
-    // handles just a very small subset of such conversions.
-
-    int arg1=vSubArguments[1]->GetFormulaToken()->GetString().
-        getString().toAsciiUpperCase().hashCode();
-    int arg2=vSubArguments[2]->GetFormulaToken()->GetString().
-        getString().toAsciiUpperCase().hashCode();
-
-    // Check if the from and to units are those combinations that the
-    // code below supports.
-    if( !((arg1==5584&&arg2==108)||
-        (arg1==108&&arg2==5584)||
-        (arg1==5665&&arg2==268206)||
-        (arg1==268206&&arg2==5665)) )
-        throw Unhandled(__FILE__, __LINE__);
-
-    FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken();
-    const formula::SingleVectorRefToken*tmpCurDVR= static_cast<const
-        formula::SingleVectorRefToken *>(tmpCur);
-    ss << "\ndouble " << sSymName;
-    ss << "_"<< BinFuncName() <<"(";
-    for (size_t i = 0; i < vSubArguments.size(); i++)
-    {
-        if (i)
-            ss << ",";
-        vSubArguments[i]->GenSlidingWindowDecl(ss);
-    }
-    ss << ")\n{\n";
-    ss <<"    int gid0=get_global_id(0);\n";
-    ss << "    double arg0 = " << vSubArguments[0]->GenSlidingWindowDeclRef();
-    ss << ";\n";
-    ss << "    double arg1 = " << vSubArguments[1]->GenSlidingWindowDeclRef();
-    ss << ";\n";
-    ss << "    double arg2 = " << vSubArguments[2]->GenSlidingWindowDeclRef();
-    ss << ";\n";
-    ss<< "    if(isnan(arg0)||(gid0>=";
-    ss<<tmpCurDVR->GetArrayLength();
-    ss<<"))\n";
-    ss<<"        arg0 = 0;\n";
-    ss<< "    if(isnan(arg1)||(gid0>=";
-    ss<<tmpCurDVR->GetArrayLength();
-    ss<<"))\n";
-    ss<<"        arg1 = 0;\n";
-    ss<< "    if(isnan(arg2)||(gid0>=";
-    ss<<tmpCurDVR->GetArrayLength();
-    ss<<"))\n";
-    ss<<"        arg2 = 0;\n";
-    ss<<"    if(arg1==5584U&&arg2==108U)\n";
-    ss<<"        return arg0*1000.0;\n";
-    ss<<"    else if(arg1==108U&&arg2==3385U)\n";
-    ss<<"        return arg0/1000.0;\n";
-    ss<<"    else if(arg1==5665U&&arg2==268206U)\n";
-    ss<<"        return arg0*60.0;\n";
-    ss<<"    else if(arg1==268206U&&arg2==5665U)\n";
-    ss<<"        return arg0/60.0;\n";
-    ss<<"    else\n";
-    ss<<"        return -9999999999;\n";
-    ss << "}\n";
-
-}
 
 void OpProduct::GenSlidingWindowFunction(std::stringstream &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 f001d1b78beb..e8111403abbf 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -356,15 +356,6 @@ public:
             const std::string &sSymName, SubArguments &vSubArguments) override;
     virtual std::string BinFuncName() const override { return "Log10"; }
 };
-class OpConvert: public Normal
-{
-public:
-    virtual void GenSlidingWindowFunction(std::stringstream &ss,
-        const std::string &sSymName, SubArguments &vSubArguments) override;
-    virtual std::string BinFuncName() const override { return "Convert"; }
-    virtual bool takeString() const override { return true; }
-
-};
 class OpEven: public Normal
 {
 public:

Reply via email to