mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-14 21:09:55 +02:00
remove WEBP_FORCE_ALIGNED and use memcpy() instead.
BUG=webp:297 Change-Id: I89a08debec7bb1b3f411c897260ab1bb63f77df2
This commit is contained in:
committed by
James Zern
parent
005e15b10a
commit
3884972e3f
@ -54,7 +54,6 @@ WEBP_EXTERN(void) WebPSafeFree(void* const ptr);
|
||||
#define WEBP_ALIGN_CST 31
|
||||
#define WEBP_ALIGN(PTR) (((uintptr_t)(PTR) + WEBP_ALIGN_CST) & ~WEBP_ALIGN_CST)
|
||||
|
||||
#if defined(WEBP_FORCE_ALIGNED)
|
||||
#include <string.h>
|
||||
// memcpy() is the safe way of moving potentially unaligned 32b memory.
|
||||
static WEBP_INLINE uint32_t WebPMemToUint32(const uint8_t* const ptr) {
|
||||
@ -65,16 +64,6 @@ static WEBP_INLINE uint32_t WebPMemToUint32(const uint8_t* const ptr) {
|
||||
static WEBP_INLINE void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) {
|
||||
memcpy(ptr, &val, sizeof(val));
|
||||
}
|
||||
#else
|
||||
static WEBP_UBSAN_IGNORE_UNDEF WEBP_INLINE
|
||||
uint32_t WebPMemToUint32(const uint8_t* const ptr) {
|
||||
return *(const uint32_t*)ptr;
|
||||
}
|
||||
static WEBP_UBSAN_IGNORE_UNDEF WEBP_INLINE
|
||||
void WebPUint32ToMem(uint8_t* const ptr, uint32_t val) {
|
||||
*(uint32_t*)ptr = val;
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Reading/writing data.
|
||||
|
Reference in New Issue
Block a user