enc_sse2: prevent signed int overflow

_mm_movemask_epi8 returns a 16-bit mask; << 16 can overflow a signed
int.

Change-Id: Ia0bb0804fe548fb9b0edb3695e82727506066cda
This commit is contained in:
James Zern 2014-06-04 23:16:58 -07:00
parent 3fdaf4d28c
commit db4860b355

View File

@ -949,7 +949,7 @@ void VP8SetResidualCoeffsSSE2(const int16_t* const coeffs,
// are not equal to zero. Finally, mask out least significant bits according
// to res->first.
const uint32_t mask =
~((_mm_movemask_epi8(m1) << 16) | _mm_movemask_epi8(m0)) &
~(((uint32_t)_mm_movemask_epi8(m1) << 16) | _mm_movemask_epi8(m0)) &
-(1U << (res->first << 1));
// The position of the most significant non-zero bit indicates the position of
// the last non-zero value. Divide the result by two because __movemask_epi8