summaryrefslogtreecommitdiff
path: root/sc/source/core/opencl/op_math.cxx
diff options
context:
space:
mode:
authoryiming ju <yiming@multicorewareinc.com>2013-11-07 15:08:02 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 17:44:14 -0600
commit2d30a56f77dc7e50fd6050f223b52c2a0c0ab311 (patch)
treed4c2e92ef3200afbd9bb917f2cf52c2e0639a092 /sc/source/core/opencl/op_math.cxx
parentb07bfeea13e32a6fbf70d5932901a95c02ebf878 (diff)
GPU Calc: implemented ROUND
AMLOEXT-156 FIX Change-Id: I149b663736b1d126414ce034262e83fd05a558fb Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc/source/core/opencl/op_math.cxx')
-rw-r--r--sc/source/core/opencl/op_math.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index 569a7173c013..7e76952502cd 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -629,6 +629,33 @@ void OpLn::GenSlidingWindowFunction(
ss << " return tmp;\n";
ss << "}";
}
+
+void OpRound::GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments)
+{
+ ss << "\ndouble " << sSymName;
+ ss << "_"<< BinFuncName() <<"(";
+ for (unsigned 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 << " int singleIndex = gid0;\n";
+ GenTmpVariables(ss,vSubArguments);
+ CheckAllSubArgumentIsNan(ss,vSubArguments);
+ ss << " for(int i=0;i<tmp1;i++)\n";
+ ss << " tmp0 = tmp0 * 10;\n";
+ ss << " double tmp=round(tmp0);\n";
+ ss << " for(int i=0;i<tmp1;i++)\n";
+ ss << " tmp = tmp / 10;\n";
+ ss << " return tmp;\n";
+ ss << "}";
+}
+
+
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */