| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkMath_DEFINED | 10 #ifndef SkMath_DEFINED |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 int32_t SkSqrtBits(int32_t value, int bitBias); | 65 int32_t SkSqrtBits(int32_t value, int bitBias); |
| 66 | 66 |
| 67 /** Return the integer square root of n, treated as a SkFixed (16.16) | 67 /** Return the integer square root of n, treated as a SkFixed (16.16) |
| 68 */ | 68 */ |
| 69 #define SkSqrt32(n) SkSqrtBits(n, 15) | 69 #define SkSqrt32(n) SkSqrtBits(n, 15) |
| 70 | 70 |
| 71 //! Returns the number of leading zero bits (0...32) | 71 //! Returns the number of leading zero bits (0...32) |
| 72 int SkCLZ_portable(uint32_t); | 72 int SkCLZ_portable(uint32_t); |
| 73 | 73 |
| 74 #ifndef SkCLZ | 74 #ifndef SkCLZ |
| 75 #if defined(_MSC_VER) && _MSC_VER >= 1400 | 75 #if defined(_MSC_VER) |
| 76 #include <intrin.h> | 76 #include <intrin.h> |
| 77 | 77 |
| 78 static inline int SkCLZ(uint32_t mask) { | 78 static inline int SkCLZ(uint32_t mask) { |
| 79 if (mask) { | 79 if (mask) { |
| 80 DWORD index; | 80 DWORD index; |
| 81 _BitScanReverse(&index, mask); | 81 _BitScanReverse(&index, mask); |
| 82 // Suppress this bogus /analyze warning. The check for non-zero | 82 // Suppress this bogus /analyze warning. The check for non-zero |
| 83 // guarantees that _BitScanReverse will succeed. | 83 // guarantees that _BitScanReverse will succeed. |
| 84 #pragma warning(suppress : 6102) // Using 'index' from failed function call | 84 #pragma warning(suppress : 6102) // Using 'index' from failed function call |
| 85 return index ^ 0x1F; | 85 return index ^ 0x1F; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 *div = static_cast<Out>(d); | 195 *div = static_cast<Out>(d); |
| 196 *mod = static_cast<Out>(numer-d*denom); | 196 *mod = static_cast<Out>(numer-d*denom); |
| 197 #else | 197 #else |
| 198 // On x86 this will just be a single idiv. | 198 // On x86 this will just be a single idiv. |
| 199 *div = static_cast<Out>(numer/denom); | 199 *div = static_cast<Out>(numer/denom); |
| 200 *mod = static_cast<Out>(numer%denom); | 200 *mod = static_cast<Out>(numer%denom); |
| 201 #endif | 201 #endif |
| 202 } | 202 } |
| 203 | 203 |
| 204 #endif | 204 #endif |
| OLD | NEW |