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.lunak@collabora.com>
This commit is contained in:
Luboš Luňák
2022-08-31 09:13:37 +02:00
parent 19e64b69fe
commit 975fa7d700
3 changed files with 0 additions and 80 deletions
-5
View File
@@ -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],
-66
View File
@@ -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)
-9
View File
@@ -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: