From: Stephen Seo Date: Fri, 28 Jun 2024 09:15:40 +0000 (+0900) Subject: Fix hashing in hash_map X-Git-Tag: 1.0~102 X-Git-Url: https://git.seodisparate.com/stephenseo/search/main.js?a=commitdiff_plain;h=c5b2ca6dff112c3be4ba4e2a88a9332f79d505e4;p=SimpleArchiver Fix hashing in hash_map --- diff --git a/src/data_structures/hash_map.c b/src/data_structures/hash_map.c index 56df22a..2d97602 100644 --- a/src/data_structures/hash_map.c +++ b/src/data_structures/hash_map.c @@ -74,7 +74,8 @@ unsigned long long simple_archiver_hash_map_internal_key_to_hash( unsigned long long temp = 0; unsigned int count = 0; for (unsigned int idx = 0; idx < key_size; ++idx) { - temp |= *((unsigned char *)key + count++); + temp |= ((unsigned long long)*((unsigned char *)key)) << (8 * count); + ++count; if (count >= 8) { count = 0; seed += temp;