summaryrefslogtreecommitdiff
path: root/insert_string_tpl.h
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2024-12-17 23:02:32 +0100
committerHans Kristian Rosbach <hk-git@circlestorm.org>2024-12-17 23:02:32 +0100
commit80fffd72f316df980bb15ea0daf06ba22e3583ec (patch)
treec6d51d423ab594b3914d245fd4920d1b47104a12 /insert_string_tpl.h
parent43d74a223b30902b44b01bf4c4888d8deb35e253 (diff)
downloadProject-Tick-80fffd72f316df980bb15ea0daf06ba22e3583ec.tar.gz
Project-Tick-80fffd72f316df980bb15ea0daf06ba22e3583ec.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.h18
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