Skip to content

Commit bcee1b9

Browse files
committed
Fix unaligned access
1 parent 91f0955 commit bcee1b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/hash/hash_func32_murmur3.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <stddef.h>
88
#include <stdint.h>
9+
#include <zephyr/toolchain.h>
910

1011
static inline uint32_t murmur_32_scramble(uint32_t k)
1112
{
@@ -24,7 +25,7 @@ uint32_t sys_hash32_murmur3(const char *str, size_t n)
2425
const size_t len = n;
2526

2627
for (; n >= sizeof(uint32_t); n -= sizeof(uint32_t), str += sizeof(uint32_t)) {
27-
k = *(const uint32_t *)str;
28+
k = UNALIGNED_GET((const uint32_t *)str);
2829
h ^= murmur_32_scramble(k);
2930
h = (h << 13) | (h >> 19);
3031
h = h * 5 + 0xe6546b64;

0 commit comments

Comments
 (0)