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

Unified Diff: src/opts/SkColor_opts_SSE2.h

Issue 872243003: Don't do a pointless << 0. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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: src/opts/SkColor_opts_SSE2.h
diff --git a/src/opts/SkColor_opts_SSE2.h b/src/opts/SkColor_opts_SSE2.h
index 95fb69cceb7355f0c4405fd55087239264e5b7ea..970abb859b980dff84dd4f1085ddd967ac2b7d3e 100644
--- a/src/opts/SkColor_opts_SSE2.h
+++ b/src/opts/SkColor_opts_SSE2.h
@@ -81,8 +81,12 @@ static inline __m128i SkAlphaMulQ_SSE2(const __m128i& c, const unsigned scale) {
}
static inline __m128i SkGetPackedA32_SSE2(const __m128i& src) {
+#if SK_A32_SHIFT == 24 // It's very common (universal?) that alpha is the top byte.
+ return _mm_srli_epi32(src, 24); // You'd hope the compiler would remove the left shift then,
+#else // but I've seen Clang just do a dumb left shift of zero. :(
__m128i a = _mm_slli_epi32(src, (24 - SK_A32_SHIFT));
return _mm_srli_epi32(a, 24);
+#endif
}
static inline __m128i SkGetPackedR32_SSE2(const __m128i& src) {
« 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