add WebPMemToInt32

and use it with calls to _mm_cvtsi32_si128 and _mm_set_epi32; this calls
WebPMemToUint32, but corrects the type to avoid runtime warnings with
clang -fsanitize=integer of the form:

implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
2155905152 (32-bit, unsigned) to type 'int' changed the value to
-2139062144 (32-bit, signed)

Bug: b/229626362
Change-Id: I50101ba2b46dfaa852f02d46830f3511c80b02d9
This commit is contained in:
James Zern
2022-07-28 19:33:44 -07:00
parent b4994eaa6d
commit 4f402f34a1
5 changed files with 25 additions and 20 deletions

View File

@ -73,6 +73,11 @@ static WEBP_INLINE uint32_t WebPMemToUint32(const uint8_t* const ptr) {
memcpy(&A, ptr, sizeof(A));
return A;
}
static WEBP_INLINE int32_t WebPMemToInt32(const uint8_t* const ptr) {
return (int32_t)WebPMemToUint32(ptr);
}
static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) {
memcpy(ptr, &val, sizeof(val));
}