Revert of replace SkFixedDiv impl with native 64bit math (patchset #2 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
diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp
index e0d5194..5b46d1c 100644
--- a/bench/MathBench.cpp
+++ b/bench/MathBench.cpp
@@ -545,50 +545,6 @@
///////////////////////////////////////////////////////////////////////////////
-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;
diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h
index f920fea..8cf7a56 100644
--- a/include/core/SkFixed.h
+++ b/include/core/SkFixed.h
@@ -78,10 +78,7 @@
#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)