Index: src/core/SkMath.cpp |
diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp |
index 8a9737baa023e5c0c423d95e91b31aa40f0a6a6b..1f671d3949bc39bb08cc14f1cb72255f2ef82c7d 100644 |
--- a/src/core/SkMath.cpp |
+++ b/src/core/SkMath.cpp |
@@ -46,72 +46,6 @@ int SkCLZ_portable(uint32_t x) { |
/////////////////////////////////////////////////////////////////////////////// |
-#define DIVBITS_ITER(n) \ |
- case n: \ |
- if ((numer = (numer << 1) - denom) >= 0) \ |
- result |= 1 << (n - 1); else numer += denom |
- |
-int32_t SkDivBits(int32_t numer, int32_t denom, int shift_bias) { |
- SkASSERT(denom != 0); |
- if (numer == 0) { |
- return 0; |
- } |
- |
- // make numer and denom positive, and sign hold the resulting sign |
- int32_t sign = SkExtractSign(numer ^ denom); |
- numer = SkAbs32(numer); |
- denom = SkAbs32(denom); |
- |
- int nbits = SkCLZ(numer) - 1; |
- int dbits = SkCLZ(denom) - 1; |
- int bits = shift_bias - nbits + dbits; |
- |
- if (bits < 0) { // answer will underflow |
- return 0; |
- } |
- if (bits > 31) { // answer will overflow |
- return SkApplySign(SK_MaxS32, sign); |
- } |
- |
- denom <<= dbits; |
- numer <<= nbits; |
- |
- SkFixed result = 0; |
- |
- // do the first one |
- if ((numer -= denom) >= 0) { |
- result = 1; |
- } else { |
- numer += denom; |
- } |
- |
- // Now fall into our switch statement if there are more bits to compute |
- if (bits > 0) { |
- // make room for the rest of the answer bits |
- result <<= bits; |
- switch (bits) { |
- DIVBITS_ITER(31); DIVBITS_ITER(30); DIVBITS_ITER(29); |
- DIVBITS_ITER(28); DIVBITS_ITER(27); DIVBITS_ITER(26); |
- DIVBITS_ITER(25); DIVBITS_ITER(24); DIVBITS_ITER(23); |
- DIVBITS_ITER(22); DIVBITS_ITER(21); DIVBITS_ITER(20); |
- DIVBITS_ITER(19); DIVBITS_ITER(18); DIVBITS_ITER(17); |
- DIVBITS_ITER(16); DIVBITS_ITER(15); DIVBITS_ITER(14); |
- DIVBITS_ITER(13); DIVBITS_ITER(12); DIVBITS_ITER(11); |
- DIVBITS_ITER(10); DIVBITS_ITER( 9); DIVBITS_ITER( 8); |
- DIVBITS_ITER( 7); DIVBITS_ITER( 6); DIVBITS_ITER( 5); |
- DIVBITS_ITER( 4); DIVBITS_ITER( 3); DIVBITS_ITER( 2); |
- // we merge these last two together, makes GCC make better ARM |
- default: |
- DIVBITS_ITER( 1); |
- } |
- } |
- |
- if (result < 0) { |
- result = SK_MaxS32; |
- } |
- return SkApplySign(result, sign); |
-} |
- |
/* www.worldserver.com/turk/computergraphics/FixedSqrt.pdf |
*/ |
int32_t SkSqrtBits(int32_t x, int count) { |