Skip to content

Commit

Permalink
Revert of replace SkFixedDiv impl with native 64bit math (patchset #2
Browse files Browse the repository at this point in the history
…id:20001 of https://codereview.chromium.org/1022543003/)

Reason for revert:
http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/53096

layouttests failures

Original issue's description:
> replace SkFixedDiv impl with native 64bit math
>
> BUG=skia:
> TBR=
>
> Committed: https://skia.googlesource.com/skia/+/7c44ca926bf42b3b2e56131f250c0fd58f87ac71

TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1018523008
  • Loading branch information
reed authored and Commit bot committed Mar 19, 2015
1 parent 562d0e1 commit effcba4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
44 changes: 0 additions & 44 deletions bench/MathBench.cpp
Expand Up @@ -545,50 +545,6 @@ class FixedMathBench : public Benchmark {

///////////////////////////////////////////////////////////////////////////////

class DivBitsBench : public Benchmark {
protected:
enum {
N = 1000
};
volatile int32_t fSrc[N], fDst[N];
public:
DivBitsBench() {
SkRandom rand;
for (int i = 0; i < N; ++i) {
fSrc[i] = rand.nextU();
}
}
protected:
virtual void onDraw(const int loops, SkCanvas*) {
for (int j = 0; j < loops; ++j) {
for (int i = 0; i < N - 4; ++i) {
fDst[i] = SkDivBits(fSrc[i], fSrc[i] >> 3, 16);
}
}
}
virtual const char* onGetName() {
return "divbits";
}
};
DEF_BENCH( return new DivBitsBench; )

class FixedDivBench : public DivBitsBench {
protected:
virtual void onDraw(const int loops, SkCanvas*) {
for (int j = 0; j < loops; ++j) {
for (int i = 0; i < N - 4; ++i) {
fDst[i] = SkFixedDiv(fSrc[i], fSrc[i] >> 3);
}
}
}
virtual const char* onGetName() {
return "fixeddiv";
}
};
DEF_BENCH( return new FixedDivBench; )

///////////////////////////////////////////////////////////////////////////////

template <typename T>
class DivModBench : public Benchmark {
SkString fName;
Expand Down
5 changes: 1 addition & 4 deletions include/core/SkFixed.h
Expand Up @@ -78,10 +78,7 @@ typedef int32_t SkFixed;
#define SkFixedAbs(x) SkAbs32(x)
#define SkFixedAve(a, b) (((a) + (b)) >> 1)

static inline int32_t SkFixedDiv(int32_t numer, int32_t denom) {
int64_t tmp = ((int64_t)numer << 16) / denom;
return (int32_t)tmp;
}
#define SkFixedDiv(numer, denom) SkDivBits(numer, denom, 16)

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Now look for ASM overrides for our portable versions (should consider putting this in its own file)
Expand Down

0 comments on commit effcba4

Please sign in to comment.