diff options
author | 2013-07-30 13:16:29 +0000 | |
---|---|---|
committer | 2013-07-30 13:16:29 +0000 | |
commit | 38bad32cf5297ec6908620fd174cd08c937d331a (patch) | |
tree | 73e25dbca97c025c1bf563e25f8df66d9d53f172 /src | |
parent | 5abacf672088bed1b6cd0d149aea0db1b8035dbc (diff) |
fold SK_CPU_HAS_CONDITION_INSTR through as always defined
BUG=
R=reed@google.com
Author: mtklein@google.com
Review URL: https://chromiumcodereview.appspot.com/21122005
git-svn-id: http://skia.googlecode.com/svn/trunk@10432 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/Sk64.cpp | 6 | ||||
-rw-r--r-- | src/core/SkBitmapProcState_matrixProcs.cpp | 32 | ||||
-rw-r--r-- | src/core/SkMath.cpp | 19 | ||||
-rw-r--r-- | src/core/SkMathPriv.h | 8 | ||||
-rw-r--r-- | src/effects/gradients/SkLinearGradient.cpp | 13 |
5 files changed, 8 insertions, 70 deletions
diff --git a/src/core/Sk64.cpp b/src/core/Sk64.cpp index c530ed866f..7c195ce4fe 100644 --- a/src/core/Sk64.cpp +++ b/src/core/Sk64.cpp @@ -253,17 +253,11 @@ void Sk64::div(int32_t denom, DivOptions option) do { shift_left(rhi, rlo); -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR if ((uint32_t)denom <= (uint32_t)hi) { hi -= denom; rlo |= 1; } -#else - int32_t diff = (denom - hi - 1) >> 31; - hi -= denom & diff; - rlo -= diff; -#endif shift_left(hi, lo); } while (--bits >= 0); SkASSERT(rhi >= 0); diff --git a/src/core/SkBitmapProcState_matrixProcs.cpp b/src/core/SkBitmapProcState_matrixProcs.cpp index a3d2b08665..70d367b870 100644 --- a/src/core/SkBitmapProcState_matrixProcs.cpp +++ b/src/core/SkBitmapProcState_matrixProcs.cpp @@ -112,24 +112,12 @@ extern const SkBitmapProcState::MatrixProc RepeatX_RepeatY_Procs_neon[]; static inline U16CPU fixed_clamp(SkFixed x) { -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR - if (x < 0) + if (x < 0) { x = 0; - if (x >> 16) + } + if (x >> 16) { x = 0xFFFF; -#else - if (x >> 16) - { -#if 0 // is this faster? - x = (~x >> 31) & 0xFFFF; -#else - if (x < 0) - x = 0; - else - x = 0xFFFF; -#endif } -#endif return x; } @@ -185,20 +173,12 @@ static SkBitmapProcState::FixedTileLowBitsProc choose_tile_lowbits_proc(unsigned } static inline U16CPU int_clamp(int x, int n) { -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR - if (x >= n) + if (x >= n) { x = n - 1; - if (x < 0) + } + if (x < 0) { x = 0; -#else - if ((unsigned)x >= (unsigned)n) { - if (x < 0) { - x = 0; - } else { - x = n - 1; - } } -#endif return x; } diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp index 0efedd727b..2693e5c13c 100644 --- a/src/core/SkMath.cpp +++ b/src/core/SkMath.cpp @@ -27,7 +27,6 @@ int SkCLZ_portable(uint32_t x) { return 32; } -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR int zeros = 31; if (x & 0xFFFF0000) { sub_shift(zeros, x, 16); @@ -44,24 +43,6 @@ int SkCLZ_portable(uint32_t x) { if (x & 0x2) { sub_shift(zeros, x, 1); } -#else - int zeros = ((x >> 16) - 1) >> 31 << 4; - x <<= zeros; - - int nonzero = ((x >> 24) - 1) >> 31 << 3; - zeros += nonzero; - x <<= nonzero; - - nonzero = ((x >> 28) - 1) >> 31 << 2; - zeros += nonzero; - x <<= nonzero; - - nonzero = ((x >> 30) - 1) >> 31 << 1; - zeros += nonzero; - x <<= nonzero; - - zeros += (~x) >> 31; -#endif return zeros; } diff --git a/src/core/SkMathPriv.h b/src/core/SkMathPriv.h index 53cf43063d..4eaad8b9b1 100644 --- a/src/core/SkMathPriv.h +++ b/src/core/SkMathPriv.h @@ -33,18 +33,10 @@ static inline int32_t SkCopySign32(int32_t x, int32_t y) { @return max if value >= max, else value */ static inline unsigned SkClampUMax(unsigned value, unsigned max) { -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR if (value > max) { value = max; } return value; -#else - int diff = max - value; - // clear diff if diff is positive - diff &= diff >> 31; - - return value + diff; -#endif } /** Computes the 64bit product of a * b, and then shifts the answer down by diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 4bc697d904..2f56cb49ca 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -23,26 +23,17 @@ static inline int repeat_8bits(int x) { #endif static inline int mirror_bits(int x, const int bits) { -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR - if (x & (1 << bits)) + if (x & (1 << bits)) { x = ~x; + } return x & ((1 << bits) - 1); -#else - int s = x << (31 - bits) >> 31; - return (x ^ s) & ((1 << bits) - 1); -#endif } static inline int mirror_8bits(int x) { -#ifdef SK_CPU_HAS_CONDITIONAL_INSTR if (x & 256) { x = ~x; } return x & 255; -#else - int s = x << 23 >> 31; - return (x ^ s) & 0xFF; -#endif } #if defined(_MSC_VER) && (_MSC_VER >= 1600) |