near lossless: fix unsigned int overflow warnings.

Change-Id: Ic1111a66761b5821cbbea1c91b038b2327dd20b5
This commit is contained in:
Vincent Rabaud
2017-05-22 15:52:33 +02:00
parent 972104b34b
commit 9bbc0891c6
2 changed files with 11 additions and 7 deletions

View File

@ -1261,12 +1261,13 @@ static WEBP_INLINE uint32_t ApplyPaletteHash0(uint32_t color) {
static WEBP_INLINE uint32_t ApplyPaletteHash1(uint32_t color) {
// Forget about alpha.
return ((color & 0x00ffffffu) * 4222244071u) >> (32 - PALETTE_INV_SIZE_BITS);
return ((uint32_t)((color & 0x00ffffffu) * 4222244071ull)) >>
(32 - PALETTE_INV_SIZE_BITS);
}
static WEBP_INLINE uint32_t ApplyPaletteHash2(uint32_t color) {
// Forget about alpha.
return (color & 0x00ffffffu) * ((1u << 31) - 1) >>
return ((uint32_t)((color & 0x00ffffffu) * ((1ull << 31) - 1))) >>
(32 - PALETTE_INV_SIZE_BITS);
}