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

Unified Diff: include/core/SkUtils.h

Issue 1351403005: try simplest code: inline whenever vaguely sensible (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 4e24bd0883555e641515c8a35e0029086f4b22b6..d34975523406547f98c12f6c1180a7adb2abc614 100644
--- a/include/core/SkUtils.h
+++ b/include/core/SkUtils.h
@@ -31,12 +31,11 @@ namespace SkOpts {
@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_CPU_ARM64)
- while (count --> 0) { *buffer++ = value; } return;
-#elif defined(SK_CPU_ARM32)
- if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; }
-#endif
+#if defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
+ while (count --> 0) { *buffer++ = value; }
+#else
SkOpts::memset16(buffer, value, count);
+#endif
}
/** Similar to memset(), but it assigns a 32bit value into the buffer.
@@ -45,12 +44,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(SK_CPU_ARM64)
- while (count --> 0) { *buffer++ = value; } return;
-#elif defined(SK_CPU_ARM32)
- if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; }
-#endif
+#if defined(SK_ARM_HAS_NEON) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
+ while (count --> 0) { *buffer++ = value; }
+#else
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