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

Side by Side Diff: bench/MathBench.cpp

Issue 25026004: Fix asan build. Duh, don't return a stack address... (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkBenchmark.h" 1 #include "SkBenchmark.h"
2 #include "SkColorPriv.h" 2 #include "SkColorPriv.h"
3 #include "SkMatrix.h" 3 #include "SkMatrix.h"
4 #include "SkRandom.h" 4 #include "SkRandom.h"
5 #include "SkString.h" 5 #include "SkString.h"
6 #include "SkPaint.h" 6 #include "SkPaint.h"
7 7
8 static float sk_fsel(float pred, float result_ge, float result_lt) { 8 static float sk_fsel(float pred, float result_ge, float result_lt) {
9 return pred >= 0 ? result_ge : result_lt; 9 return pred >= 0 ? result_ge : result_lt;
10 } 10 }
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 507 }
508 508
509 private: 509 private:
510 typedef SkBenchmark INHERITED; 510 typedef SkBenchmark INHERITED;
511 }; 511 };
512 512
513 /////////////////////////////////////////////////////////////////////////////// 513 ///////////////////////////////////////////////////////////////////////////////
514 514
515 template <typename T> 515 template <typename T>
516 class DivModBench : public SkBenchmark { 516 class DivModBench : public SkBenchmark {
517 const char* fName; 517 SkString fName;
518 public: 518 public:
519 explicit DivModBench(const char* name) : fName(name) { 519 explicit DivModBench(const char* name) {
520 fName.printf("divmod_%s", name);
520 fIsRendering = false; 521 fIsRendering = false;
521 } 522 }
522 523
523 protected: 524 protected:
524 virtual const char* onGetName() { 525 virtual const char* onGetName() {
525 return SkStringPrintf("divmod_%s", fName).c_str(); 526 return fName.c_str();
526 } 527 }
527 528
528 virtual void onDraw(SkCanvas*) { 529 virtual void onDraw(SkCanvas*) {
529 volatile T a = 0, b = 0; 530 volatile T a = 0, b = 0;
530 T div = 0, mod = 0; 531 T div = 0, mod = 0;
531 for (int i = 0; i < this->getLoops(); i++) { 532 for (int i = 0; i < this->getLoops(); i++) {
532 if ((T)i == 0) continue; // Small T will wrap around. 533 if ((T)i == 0) continue; // Small T will wrap around.
533 SkTDivMod((T)(i+1), (T)i, &div, &mod); 534 SkTDivMod((T)(i+1), (T)i, &div, &mod);
534 a ^= div; 535 a ^= div;
535 b ^= mod; 536 b ^= mod;
(...skipping 28 matching lines...) Expand all
564 565
565 DEF_BENCH( return new FloorBench(false); ) 566 DEF_BENCH( return new FloorBench(false); )
566 DEF_BENCH( return new FloorBench(true); ) 567 DEF_BENCH( return new FloorBench(true); )
567 568
568 DEF_BENCH( return new CLZBench(false); ) 569 DEF_BENCH( return new CLZBench(false); )
569 DEF_BENCH( return new CLZBench(true); ) 570 DEF_BENCH( return new CLZBench(true); )
570 571
571 DEF_BENCH( return new NormalizeBench(); ) 572 DEF_BENCH( return new NormalizeBench(); )
572 573
573 DEF_BENCH( return new FixedMathBench(); ) 574 DEF_BENCH( return new FixedMathBench(); )
OLDNEW
« 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