fix bogus assert
git-svn-id: http://skia.googlecode.com/svn/trunk@4242 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
bb0b67f659
commit
357818cb76
@ -24,7 +24,7 @@ public:
|
||||
protected:
|
||||
virtual int mulLoopCount() const { return 1; }
|
||||
|
||||
virtual const char* onGetName() {
|
||||
virtual const char* onGetName() SK_OVERRIDE {
|
||||
return fName.c_str();
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ private:
|
||||
class ForcedIntComparisonBench : public ScalarBench {
|
||||
public:
|
||||
ForcedIntComparisonBench(void* param)
|
||||
: INHERITED(param, "compare_forced_int") {
|
||||
: INHERITED(param, "compare_forced_int") {
|
||||
init9(fArray);
|
||||
}
|
||||
protected:
|
||||
@ -98,6 +98,37 @@ private:
|
||||
typedef ScalarBench INHERITED;
|
||||
};
|
||||
|
||||
class IsFiniteScalarBench : public ScalarBench {
|
||||
public:
|
||||
IsFiniteScalarBench(void* param) : INHERITED(param, "isfinite") {
|
||||
SkRandom rand;
|
||||
for (size_t i = 0; i < ARRAY_N; ++i) {
|
||||
fArray[i] = rand.nextSScalar1();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
virtual int mulLoopCount() const { return 1; }
|
||||
virtual void performTest() SK_OVERRIDE {
|
||||
int sum = 0;
|
||||
for (size_t i = 0; i < ARRAY_N; ++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);
|
||||
}
|
||||
|
||||
virtual void doSomething(SkScalar array[], int sum) {}
|
||||
private:
|
||||
enum {
|
||||
ARRAY_N = 64
|
||||
};
|
||||
SkScalar fArray[ARRAY_N];
|
||||
|
||||
typedef ScalarBench INHERITED;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class RectBoundsBench : public SkBenchmark {
|
||||
@ -137,7 +168,9 @@ private:
|
||||
static SkBenchmark* S0(void* p) { return new FloatComparisonBench(p); }
|
||||
static SkBenchmark* S1(void* p) { return new ForcedIntComparisonBench(p); }
|
||||
static SkBenchmark* S2(void* p) { return new RectBoundsBench(p); }
|
||||
static SkBenchmark* S3(void* p) { return new IsFiniteScalarBench(p); }
|
||||
|
||||
static BenchRegistry gReg0(S0);
|
||||
static BenchRegistry gReg1(S1);
|
||||
static BenchRegistry gReg2(S2);
|
||||
static BenchRegistry gReg3(S3);
|
||||
|
Loading…
Reference in New Issue
Block a user