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

Unified Diff: include/core/SkMath.h

Issue 2041943002: SkLeanWindows.h: #include "Windows.h" fewer places (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-06-07 (Tuesday) 11:28:42 EDT Created 4 years, 6 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 | « gm/drawminibitmaprect.cpp ('k') | include/core/SkPostConfig.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkMath.h
diff --git a/include/core/SkMath.h b/include/core/SkMath.h
index 799939039c087659014b42b0bf62e861d2d55cc4..8276c5d04f1a89062e990c46174ca6aa1c22030d 100644
--- a/include/core/SkMath.h
+++ b/include/core/SkMath.h
@@ -61,35 +61,6 @@ int32_t SkSqrtBits(int32_t value, int bitBias);
*/
#define SkSqrt32(n) SkSqrtBits(n, 15)
-//! Returns the number of leading zero bits (0...32)
-int SkCLZ_portable(uint32_t);
-
-#ifndef SkCLZ
- #if defined(_MSC_VER)
- #include <intrin.h>
-
- static inline int SkCLZ(uint32_t mask) {
- if (mask) {
- DWORD index;
- _BitScanReverse(&index, mask);
- // Suppress this bogus /analyze warning. The check for non-zero
- // guarantees that _BitScanReverse will succeed.
-#pragma warning(suppress : 6102) // Using 'index' from failed function call
- return index ^ 0x1F;
- } else {
- return 32;
- }
- }
- #elif defined(SK_CPU_ARM32) || defined(__GNUC__) || defined(__clang__)
- static inline int SkCLZ(uint32_t mask) {
- // __builtin_clz(0) is undefined, so we have to detect that case.
- return mask ? __builtin_clz(mask) : 32;
- }
- #else
- #define SkCLZ(x) SkCLZ_portable(x)
- #endif
-#endif
-
/**
* Returns (value < 0 ? 0 : value) efficiently (i.e. no compares or branches)
*/
@@ -116,30 +87,6 @@ static inline int SkClampMax(int value, int max) {
}
/**
- * Returns the smallest power-of-2 that is >= the specified value. If value
- * is already a power of 2, then it is returned unchanged. It is undefined
- * if value is <= 0.
- */
-static inline int SkNextPow2(int value) {
- SkASSERT(value > 0);
- return 1 << (32 - SkCLZ(value - 1));
-}
-
-/**
- * Returns the log2 of the specified value, were that value to be rounded up
- * to the next power of 2. It is undefined to pass 0. Examples:
- * SkNextLog2(1) -> 0
- * SkNextLog2(2) -> 1
- * SkNextLog2(3) -> 2
- * SkNextLog2(4) -> 2
- * SkNextLog2(5) -> 3
- */
-static inline int SkNextLog2(uint32_t value) {
- SkASSERT(value != 0);
- return 32 - SkCLZ(value - 1);
-}
-
-/**
* Returns true if value is a power of 2. Does not explicitly check for
* value <= 0.
*/
« no previous file with comments | « gm/drawminibitmaprect.cpp ('k') | include/core/SkPostConfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698