From d70f7307a408bd14f371108283f02aa48b53f3be Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Tue, 12 Jun 2012 21:40:13 +0000 Subject: 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 --- bench/ScalarBench.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bench/ScalarBench.cpp') 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); -- cgit v1.2.3