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

Unified Diff: include/core/SkUtils.h

Issue 1356983004: Revert of try stosd/w (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkUtils.h
diff --git a/include/core/SkUtils.h b/include/core/SkUtils.h
index 6ddc40eab2410a62f16b4102d2a7b40d78a20cec..4e24bd0883555e641515c8a35e0029086f4b22b6 100644
--- a/include/core/SkUtils.h
+++ b/include/core/SkUtils.h
@@ -9,9 +9,6 @@
#define SkUtils_DEFINED
#include "SkTypes.h"
-#if defined(SK_BUILD_FOR_WIN)
- #include <intrin.h>
-#endif
namespace SkOpts {
extern void (*memset16)(uint16_t[], uint16_t, int);
@@ -34,15 +31,12 @@
@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(SK_BUILD_FOR_WIN)
- __stosw(buffer, value, count);
-#elif defined(SK_CPU_X86)
- __asm__ __volatile__ ( "rep stosw" : "+D"(buffer), "+c"(count) : "a"(value) );
-#elif defined(SK_ARM_HAS_NEON)
- while (count --> 0) { *buffer++ = value; }
-#else
+#if defined(SK_CPU_ARM64)
+ while (count --> 0) { *buffer++ = value; } return;
+#elif defined(SK_CPU_ARM32)
+ if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; }
+#endif
SkOpts::memset16(buffer, value, count);
-#endif
}
/** Similar to memset(), but it assigns a 32bit value into the buffer.
@@ -51,15 +45,12 @@
@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(SK_BUILD_FOR_WIN)
- __stosd((PDWORD)buffer, value, count);
-#elif defined(SK_CPU_X86)
- __asm__ __volatile__ ( "rep stosl" : "+D"(buffer), "+c"(count) : "a"(value) );
-#elif defined(SK_ARM_HAS_NEON)
- while (count --> 0) { *buffer++ = value; }
-#else
+#if defined(SK_CPU_ARM64)
+ while (count --> 0) { *buffer++ = value; } return;
+#elif defined(SK_CPU_ARM32)
+ if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; }
+#endif
SkOpts::memset32(buffer, value, count);
-#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698