aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/ScalarBench.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-12 21:40:13 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-12 21:40:13 +0000
commitd70f7307a408bd14f371108283f02aa48b53f3be (patch)
tree249dd829d6fdcf84e025c103ae46133a4d29bd7c /bench/ScalarBench.cpp
parentdf9d6f17681ee38cc82b1ee0f328314412c1a94b (diff)
pass -fArray[i] instead of fArray[i], to skip a compiler optimization where it
thought it could tread the memory as if it pointed to an int instead of a float. git-svn-id: http://skia.googlecode.com/svn/trunk@4240 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/ScalarBench.cpp')
-rw-r--r--bench/ScalarBench.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/bench/ScalarBench.cpp b/bench/ScalarBench.cpp
index fe14251b65..c03f9ca9d7 100644
--- a/bench/ScalarBench.cpp
+++ b/bench/ScalarBench.cpp
@@ -112,7 +112,9 @@ protected:
virtual void performTest() SK_OVERRIDE {
int sum = 0;
for (size_t i = 0; i < ARRAY_N; ++i) {
- sum += SkScalarIsFinite(fArray[i]);
+ // We pass -fArray[i], so the compiler can't cheat and treat the
+ // value as an int (even though we tell it that it is a float)
+ sum += SkScalarIsFinite(-fArray[i]);
}
// we do this so the compiler won't optimize our loop away...
this->doSomething(fArray, sum);