From: Cameron Cawley Date: Sun, 25 Feb 2024 18:08:53 +0000 (+0000) Subject: Make use of unaligned loads on big endian in insert_string X-Git-Tag: 2.2.2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c327d181313d026673953a0c88c5ee09fe56930a;p=thirdparty%2Fzlib-ng.git Make use of unaligned loads on big endian in insert_string --- diff --git a/insert_string_tpl.h b/insert_string_tpl.h index 281c01346..a5685c4ed 100644 --- a/insert_string_tpl.h +++ b/insert_string_tpl.h @@ -29,9 +29,15 @@ # define HASH_CALC_MASK HASH_MASK #endif #ifndef HASH_CALC_READ -# if BYTE_ORDER == LITTLE_ENDIAN -# define HASH_CALC_READ \ - memcpy(&val, strstart, sizeof(val)); +# ifdef UNALIGNED_OK +# if BYTE_ORDER == LITTLE_ENDIAN +# define HASH_CALC_READ \ + memcpy(&val, strstart, sizeof(val)); +# else +# define HASH_CALC_READ \ + memcpy(&val, strstart, sizeof(val)); \ + val = ZSWAP32(val); +# endif # else # define HASH_CALC_READ \ val = ((uint32_t)(strstart[0])); \