summaryrefslogtreecommitdiff
path: root/insert_string_tpl.h
diff options
context:
space:
mode:
authorCameron Cawley <ccawley2011@gmail.com>2023-07-27 21:07:29 +0100
committerHans Kristian Rosbach <hk-github@circlestorm.org>2024-12-24 12:55:44 +0100
commitd7e121e56b64b5916810cf32615062a53f954773 (patch)
tree9550b4e4222fa2727bd4d815cea531b2c201e71a /insert_string_tpl.h
parentfc90e7b3fc57497b315e03fcd3b8465022a08855 (diff)
downloadProject-Tick-d7e121e56b64b5916810cf32615062a53f954773.tar.gz
Project-Tick-d7e121e56b64b5916810cf32615062a53f954773.zip
Use GCC's may_alias attribute for unaligned memory access
Diffstat (limited to 'insert_string_tpl.h')
-rw-r--r--insert_string_tpl.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/insert_string_tpl.h b/insert_string_tpl.h
index e7037c04e6..1548ca741a 100644
--- a/insert_string_tpl.h
+++ b/insert_string_tpl.h
@@ -22,6 +22,8 @@
*
*/
+#include "zmemory.h"
+
#ifndef HASH_CALC_OFFSET
# define HASH_CALC_OFFSET 0
#endif
@@ -31,11 +33,10 @@
#ifndef HASH_CALC_READ
# if BYTE_ORDER == LITTLE_ENDIAN
# define HASH_CALC_READ \
- memcpy(&val, strstart, sizeof(val));
+ val = zng_memread_4(strstart);
# else
# define HASH_CALC_READ \
- memcpy(&val, strstart, sizeof(val)); \
- val = ZSWAP32(val);
+ val = ZSWAP32(zng_memread_4(strstart));
# endif
#endif