| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkUtils_DEFINED | 8 #ifndef SkUtils_DEFINED |
| 9 #define SkUtils_DEFINED | 9 #define SkUtils_DEFINED |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // code was not helpful; it's got to be here outside. | 24 // code was not helpful; it's got to be here outside. |
| 25 // - NEON code generation for ARMv8 with GCC 4.9 is terrible, | 25 // - NEON code generation for ARMv8 with GCC 4.9 is terrible, |
| 26 // making the NEON code ~8x slower that just a serial loop. | 26 // making the NEON code ~8x slower that just a serial loop. |
| 27 | 27 |
| 28 /** Similar to memset(), but it assigns a 16bit value into the buffer. | 28 /** Similar to memset(), but it assigns a 16bit value into the buffer. |
| 29 @param buffer The memory to have value copied into it | 29 @param buffer The memory to have value copied into it |
| 30 @param value The 16bit value to be copied into buffer | 30 @param value The 16bit value to be copied into buffer |
| 31 @param count The number of times value should be copied into the buffer. | 31 @param count The number of times value should be copied into the buffer. |
| 32 */ | 32 */ |
| 33 static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) { | 33 static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) { |
| 34 #if defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 34 #if defined(SK_CPU_ARM64) |
| 35 while (count --> 0) { *buffer++ = value; } | 35 while (count --> 0) { *buffer++ = value; } return; |
| 36 #else | 36 #elif defined(SK_CPU_ARM32) |
| 37 if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; } |
| 38 #endif |
| 37 SkOpts::memset16(buffer, value, count); | 39 SkOpts::memset16(buffer, value, count); |
| 38 #endif | |
| 39 } | 40 } |
| 40 | 41 |
| 41 /** Similar to memset(), but it assigns a 32bit value into the buffer. | 42 /** Similar to memset(), but it assigns a 32bit value into the buffer. |
| 42 @param buffer The memory to have value copied into it | 43 @param buffer The memory to have value copied into it |
| 43 @param value The 32bit value to be copied into buffer | 44 @param value The 32bit value to be copied into buffer |
| 44 @param count The number of times value should be copied into the buffer. | 45 @param count The number of times value should be copied into the buffer. |
| 45 */ | 46 */ |
| 46 static inline void sk_memset32(uint32_t buffer[], uint32_t value, int count) { | 47 static inline void sk_memset32(uint32_t buffer[], uint32_t value, int count) { |
| 47 #if defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 48 #if defined(SK_CPU_ARM64) |
| 48 while (count --> 0) { *buffer++ = value; } | 49 while (count --> 0) { *buffer++ = value; } return; |
| 49 #else | 50 #elif defined(SK_CPU_ARM32) |
| 51 if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; } |
| 52 #endif |
| 50 SkOpts::memset32(buffer, value, count); | 53 SkOpts::memset32(buffer, value, count); |
| 51 #endif | |
| 52 } | 54 } |
| 53 | 55 |
| 54 | 56 |
| 55 /////////////////////////////////////////////////////////////////////////////// | 57 /////////////////////////////////////////////////////////////////////////////// |
| 56 | 58 |
| 57 #define kMaxBytesInUTF8Sequence 4 | 59 #define kMaxBytesInUTF8Sequence 4 |
| 58 | 60 |
| 59 #ifdef SK_DEBUG | 61 #ifdef SK_DEBUG |
| 60 int SkUTF8_LeadByteToCount(unsigned c); | 62 int SkUTF8_LeadByteToCount(unsigned c); |
| 61 #else | 63 #else |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 124 } |
| 123 ~SkAutoTrace() { | 125 ~SkAutoTrace() { |
| 124 SkDebugf("--- trace: %s Leave\n", fLabel); | 126 SkDebugf("--- trace: %s Leave\n", fLabel); |
| 125 } | 127 } |
| 126 private: | 128 private: |
| 127 const char* fLabel; | 129 const char* fLabel; |
| 128 }; | 130 }; |
| 129 #define SkAutoTrace(...) SK_REQUIRE_LOCAL_VAR(SkAutoTrace) | 131 #define SkAutoTrace(...) SK_REQUIRE_LOCAL_VAR(SkAutoTrace) |
| 130 | 132 |
| 131 #endif | 133 #endif |
| OLD | NEW |