From d0256a2fbcc344a7eabea76a083372260cab0969 Mon Sep 17 00:00:00 2001 From: mtklein Date: Fri, 9 Jan 2015 08:33:36 -0800 Subject: PictureNestingBench: stay in ints. BUG=skia: Review URL: https://codereview.chromium.org/784173004 --- bench/PictureNestingBench.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bench/PictureNestingBench.cpp') diff --git a/bench/PictureNestingBench.cpp b/bench/PictureNestingBench.cpp index 7868f46c9f..a3193e61aa 100644 --- a/bench/PictureNestingBench.cpp +++ b/bench/PictureNestingBench.cpp @@ -14,8 +14,6 @@ #include "SkPictureRecorder.h" #include "SkString.h" -#include - 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((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; -- cgit v1.2.3