yuv_sse2: fix -Wconstant-conversion warning

'implicit conversion from 'int' to 'short' changes value from 33050 to
-32486'

original patch:

https://codereview.chromium.org/1657313003/

Make libwebp build with -Wconstant-conversion from newer clangs.

After http://llvm.org/viewvc/llvm-project?rev=259271&view=rev, clang
points out that _mm_set1_epi16(33050) causes an overflow in the short
argument to _mm_set1_epi16().  Since there's no version that takes an
unsigned short, add an explicit cast to tell the compiler that this is
intentional.

No behavior change.

Change-Id: I6b4e3401b15cfbcc895f9e81b5c2dc59d43ffb9b
This commit is contained in:
Nico Weber 2016-02-02 14:44:13 -08:00 committed by James Zern
parent a7a03e9f96
commit 3ef1ce98b9

View File

@ -33,7 +33,8 @@ static void ConvertYUV444ToRGB(const __m128i* const Y0,
const __m128i k19077 = _mm_set1_epi16(19077); const __m128i k19077 = _mm_set1_epi16(19077);
const __m128i k26149 = _mm_set1_epi16(26149); const __m128i k26149 = _mm_set1_epi16(26149);
const __m128i k14234 = _mm_set1_epi16(14234); const __m128i k14234 = _mm_set1_epi16(14234);
const __m128i k33050 = _mm_set1_epi16(33050); // 33050 doesn't fit in a signed short: only use this with unsigned arithmetic
const __m128i k33050 = _mm_set1_epi16((short)33050);
const __m128i k17685 = _mm_set1_epi16(17685); const __m128i k17685 = _mm_set1_epi16(17685);
const __m128i k6419 = _mm_set1_epi16(6419); const __m128i k6419 = _mm_set1_epi16(6419);
const __m128i k13320 = _mm_set1_epi16(13320); const __m128i k13320 = _mm_set1_epi16(13320);