Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: include/core/SkTypes.h

Issue 21122005: fold SK_CPU_HAS_CONDITION_INSTR through as always defined (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: typo Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPreConfig.h ('k') | src/core/Sk64.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTypes.h
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index 9b3233a87e77c285394318b9ca22132a535cbcb1..48a6de80dd131ba34da1aa3f99a690dc8eb564c1 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -285,14 +285,10 @@ template <typename T> inline void SkTSwap(T& a, T& b) {
}
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 SkSign32(int32_t a) {
}
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)
- value = max;
-#else
- if (value < min)
- value = min;
- else if (value > max)
+ }
+ if (value > max) {
value = max;
-#endif
+ }
return value;
}
« no previous file with comments | « include/core/SkPreConfig.h ('k') | src/core/Sk64.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698