Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: bench/PictureNestingBench.cpp

Issue 784173004: PictureNestingBench: stay in ints. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PictureNestingBench.cpp
diff --git a/bench/PictureNestingBench.cpp b/bench/PictureNestingBench.cpp
index 7868f46c9fd60190cb64bb20971dabd91502366f..a3193e61aa2f43671286d63b39477d82bd019163 100644
--- a/bench/PictureNestingBench.cpp
+++ b/bench/PictureNestingBench.cpp
@@ -14,8 +14,6 @@
#include "SkPictureRecorder.h"
#include "SkString.h"
-#include <math.h>
-
class PictureNesting : public Benchmark {
public:
PictureNesting(const char* name, int maxLevel, int maxPictureLevel)
@@ -93,7 +91,13 @@ private:
// f(0) = 0
// via "recursive function to closed form" tricks
// f(m) = 1/2 (3^m - 1)
- return static_cast<int>((pow(3.0, fMaxPictureLevel) - 1.0) / 2.0);
+ int pics = 1;
+ for (int i = 0; i < fMaxPictureLevel; i++) {
+ pics *= 3;
+ }
+ pics--;
+ pics /= 2;
+ return pics;
}
SkString fName;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698