summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorzhenyu yuan <zhenyuyuan@multicorewareinc.com>2013-12-03 10:44:48 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-12-18 20:34:51 -0600
commitea85561eb725eebf44fa10046567c33de5984679 (patch)
treefa3771a931fedd5e30efe00c1170c9d0f0938c87 /sc/source
parent3ae85b912136993ccf157832f409416472026f17 (diff)
GPU Calc: Optimized EVEN
AMLOEXT-250 Change-Id: Id2863ad9f4a3e2a03223b1dacd33c7d7557be63d Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: Wei Wei <weiwei@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/opencl/op_math.cxx19
1 files changed, 7 insertions, 12 deletions
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index 2d5ae395cbc7..9dc0270232d8 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -227,22 +227,17 @@ void OpEven::GenSlidingWindowFunction(std::stringstream &ss,
ss<<" arg0 = 0;\n";
#endif
ss << " double tmp;\n";
- ss << " arg0 = arg0 / 2;\n";
- ss << " if (arg0 < 0)\n";
- ss << " if (trunc(arg0) == arg0)\n";
- ss << " tmp = arg0 * 2;\n";
- ss << " else\n";
- ss << " tmp = (trunc(arg0) - 1) * 2;\n";
- ss << " else if (arg0 > 0)\n";
- ss << " if (trunc(arg0) == arg0)\n";
- ss << " tmp = arg0 * 2;\n";
- ss << " else\n";
- ss << " tmp = (trunc(arg0) + 1) * 2;\n";
+ ss << " tmp = fabs(arg0 / 2);\n";
+ ss << " if ( trunc(tmp) == tmp )\n";
+ ss << " tmp = tmp * 2;\n";
ss << " else\n";
- ss << " tmp = 0;\n";
+ ss << " tmp = (trunc(tmp) + 1) * 2;\n";
+ ss << " if (arg0 < 0)\n";
+ ss << " tmp = tmp * -1.0;\n";
ss << " return tmp;\n";
ss << "}";
}
+
void OpMod::GenSlidingWindowFunction(std::stringstream &ss,
const std::string sSymName, SubArguments &vSubArguments)
{