diff options
author | Mike Reed <reed@google.com> | 2017-08-09 13:32:04 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-09 17:51:57 +0000 |
commit | c270423de16f54af26147280c406b8b74ab07046 (patch) | |
tree | 78dc284f737ee8e756aeed230f88cef39457a8de /bench/MathBench.cpp | |
parent | 5400c0b0e2cf8f2e4f09f7a8ff3d314b936b65e2 (diff) |
use unsigned to avoid runtime overflow detection
Bug: skia:
Change-Id: I487930955f75048ea27a1bcc61f7e0849c63759b
Reviewed-on: https://skia-review.googlesource.com/32681
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'bench/MathBench.cpp')
-rw-r--r-- | bench/MathBench.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp index 1ae683aab8..3b0fd099ab 100644 --- a/bench/MathBench.cpp +++ b/bench/MathBench.cpp @@ -630,12 +630,13 @@ public: // These exist to try to stop the compiler from detecting what we doing, and throwing // parts away (or knowing exactly how big the loop counts are). - virtual void process(int) {} + virtual void process(unsigned) {} virtual int count() { return ARRAY; } protected: void onDraw(int loops, SkCanvas*) override { - int accum = 0; + // used unsigned to avoid undefined behavior if/when the += might overflow + unsigned accum = 0; for (int j = 0; j < loops; ++j) { int n = this->count(); |