diff options
| author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2024-12-17 23:02:32 +0100 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2024-12-21 00:46:48 +0100 |
| commit | 509f6b5818cc8f804574ffe124d91d1c0696f753 (patch) | |
| tree | 60c32f2da361d7ce6ea9eb107e97f6e85cb6aad1 /insert_string_tpl.h | |
| parent | 4fa76be6c00914f92d74142fc36c88f868cdb69c (diff) | |
| download | Project-Tick-509f6b5818cc8f804574ffe124d91d1c0696f753.tar.gz Project-Tick-509f6b5818cc8f804574ffe124d91d1c0696f753.zip | |
Since we long ago make unaligned reads safe (by using memcpy or intrinsics),
it is time to replace the UNALIGNED_OK checks that have since really only been
used to select the optimal comparison sizes for the arch instead.
Diffstat (limited to 'insert_string_tpl.h')
| -rw-r--r-- | insert_string_tpl.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/insert_string_tpl.h b/insert_string_tpl.h index a5685c4ed7..e7037c04e6 100644 --- a/insert_string_tpl.h +++ b/insert_string_tpl.h @@ -29,21 +29,13 @@ # define HASH_CALC_MASK HASH_MASK #endif #ifndef HASH_CALC_READ -# 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 +# if BYTE_ORDER == LITTLE_ENDIAN +# define HASH_CALC_READ \ + memcpy(&val, strstart, sizeof(val)); # else # define HASH_CALC_READ \ - val = ((uint32_t)(strstart[0])); \ - val |= ((uint32_t)(strstart[1]) << 8); \ - val |= ((uint32_t)(strstart[2]) << 16); \ - val |= ((uint32_t)(strstart[3]) << 24); + memcpy(&val, strstart, sizeof(val)); \ + val = ZSWAP32(val); # endif #endif |
