Fix UB unaligned load

This commit is contained in:
Ben Noordhuis 2023-11-08 19:03:53 +01:00
parent 0068db8a11
commit 8956d6bbd3

View file

@ -159,11 +159,7 @@ int lre_case_conv(uint32_t *res, uint32_t c, int conv_type)
static uint32_t get_le24(const uint8_t *ptr)
{
#if defined(__x86__) || defined(__x86_64__)
return *(uint16_t *)ptr | (ptr[2] << 16);
#else
return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16);
#endif
}
#define UNICODE_INDEX_BLOCK_LEN 32