diff options
author | mtklein <mtklein@chromium.org> | 2015-01-26 07:07:03 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-26 07:07:03 -0800 |
commit | 8d029a4ebeda9d99c40b864e9c93c55be58b05af (patch) | |
tree | 2de8a4b2cdac936bf6fb5072f63d6a8c26aef23e /src/opts | |
parent | 65327efb5bf42b5b9acaa8198e6c5252b07b0ada (diff) |
Don't do a pointless << 0.
It's very common (universal?) that alpha is the top byte.
You'd hope the compiler would remove the left shift then,
but I've seen Clang just do a dumb left shift of zero. :(
BUG=skia:
Review URL: https://codereview.chromium.org/872243003
Diffstat (limited to 'src/opts')
-rw-r--r-- | src/opts/SkColor_opts_SSE2.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/opts/SkColor_opts_SSE2.h b/src/opts/SkColor_opts_SSE2.h index 95fb69cceb..970abb859b 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) { |