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
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 9b3233a..48a6de8 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -285,14 +285,10 @@
}
static inline int32_t SkAbs32(int32_t value) {
-#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
- if (value < 0)
+ if (value < 0) {
value = -value;
+ }
return value;
-#else
- int32_t mask = value >> 31;
- return (value ^ mask) - mask;
-#endif
}
template <typename T> inline T SkTAbs(T value) {
@@ -327,32 +323,21 @@
}
static inline int32_t SkFastMin32(int32_t value, int32_t max) {
-#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
- if (value > max)
+ if (value > max) {
value = max;
+ }
return value;
-#else
- int diff = max - value;
- // clear diff if it is negative (clear if value > max)
- diff &= (diff >> 31);
- return value + diff;
-#endif
}
/** Returns signed 32 bit value pinned between min and max, inclusively
*/
static inline int32_t SkPin32(int32_t value, int32_t min, int32_t max) {
-#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
- if (value < min)
+ if (value < min) {
value = min;
- if (value > max)
+ }
+ if (value > max) {
value = max;
-#else
- if (value < min)
- value = min;
- else if (value > max)
- value = max;
-#endif
+ }
return value;
}