From 24686538bed67cbd1498fdcb9cd1918ab7c49d1d Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 3 Apr 2019 22:39:39 -0700 Subject: [PATCH] PutLE{16,24}: quiet implicit conversion warnings no change in object code from clang-7 -fsanitize=implicit-integer-truncation implicit conversion from type 'int' of value 39736 (32-bit, signed) to type 'uint8_t' (aka 'unsigned char') changed the value to 56 (8-bit, unsigned) Change-Id: I0ecf24c5b1b11e056c58b3b85ea529c30cdadf57 --- src/utils/utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/utils.h b/src/utils/utils.h index c7620f91..2a3ec926 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -92,14 +92,14 @@ static WEBP_INLINE uint32_t GetLE32(const uint8_t* const data) { // Store 16, 24 or 32 bits in little-endian order. static WEBP_INLINE void PutLE16(uint8_t* const data, int val) { assert(val < (1 << 16)); - data[0] = (val >> 0); - data[1] = (val >> 8); + data[0] = (val >> 0) & 0xff; + data[1] = (val >> 8) & 0xff; } static WEBP_INLINE void PutLE24(uint8_t* const data, int val) { assert(val < (1 << 24)); PutLE16(data, val & 0xffff); - data[2] = (val >> 16); + data[2] = (val >> 16) & 0xff; } static WEBP_INLINE void PutLE32(uint8_t* const data, uint32_t val) {