| Index: include/core/SkUtils.h
|
| diff --git a/include/core/SkUtils.h b/include/core/SkUtils.h
|
| index 2b390f04e5270b1ed64c1bfaaffe0f5be91b69bd..b5674eceadebb9516223b7875c73bb84c97928d1 100644
|
| --- a/include/core/SkUtils.h
|
| +++ b/include/core/SkUtils.h
|
| @@ -10,36 +10,15 @@
|
|
|
| #include "SkTypes.h"
|
|
|
| -namespace SkOpts {
|
| - extern void (*memset16)(uint16_t[], uint16_t, int);
|
| - extern void (*memset32)(uint32_t[], uint32_t, int);
|
| -}
|
| -
|
| -///////////////////////////////////////////////////////////////////////////////
|
| -
|
| -// Inlining heuristics were determined by using perf.skia.org and bench/MemsetBench.cpp.
|
| -// When using MSVC, inline is better >= 1K and worse <= 100. The Nexus Player was the opposite.
|
| -// Otherwise, when NEON or SSE is available to GCC or Clang, they can handle it best.
|
| -// See https://code.google.com/p/chromium/issues/detail?id=516426#c15 for more details.
|
| -// See also skia:4316; it might be a good idea to use rep stosw/stosd here.
|
| -#define INLINE_IF(cond) if (cond) { while (count --> 0) { *buffer++ = value; } return; }
|
| -
|
| /** Similar to memset(), but it assigns a 16bit value into the buffer.
|
| @param buffer The memory to have value copied into it
|
| @param value The 16bit value to be copied into buffer
|
| @param count The number of times value should be copied into the buffer.
|
| */
|
| static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) {
|
| -#if defined(_MSC_VER)
|
| - INLINE_IF(count > 300)
|
| -#elif defined(SK_BUILD_FOR_ANDROID) && defined(SK_CPU_X86)
|
| - INLINE_IF(count < 300)
|
| -#elif defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
|
| - INLINE_IF(true)
|
| -#else
|
| - INLINE_IF(count <= 10)
|
| -#endif
|
| - SkOpts::memset16(buffer, value, count);
|
| + for (int i = 0; i < count; i++) {
|
| + buffer[i] = value;
|
| + }
|
| }
|
|
|
| /** Similar to memset(), but it assigns a 32bit value into the buffer.
|
| @@ -48,20 +27,11 @@ static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) {
|
| @param count The number of times value should be copied into the buffer.
|
| */
|
| static inline void sk_memset32(uint32_t buffer[], uint32_t value, int count) {
|
| -#if defined(_MSC_VER)
|
| - INLINE_IF(count > 300)
|
| -#elif defined(SK_BUILD_FOR_ANDROID) && defined(SK_CPU_X86)
|
| - INLINE_IF(count < 300)
|
| -#elif defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
|
| - INLINE_IF(true)
|
| -#else
|
| - INLINE_IF(count <= 10)
|
| -#endif
|
| - SkOpts::memset32(buffer, value, count);
|
| + for (int i = 0; i < count; i++) {
|
| + buffer[i] = value;
|
| + }
|
| }
|
|
|
| -#undef INLINE_IF
|
| -
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| #define kMaxBytesInUTF8Sequence 4
|
|
|