]> git.seodisparate.com - SimpleArchiver/commitdiff
Fix hashing in hash_map (hopefully finally)
authorStephen Seo <seo.disparate@gmail.com>
Fri, 28 Jun 2024 09:19:29 +0000 (18:19 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Fri, 28 Jun 2024 09:19:29 +0000 (18:19 +0900)
src/data_structures/hash_map.c

index 3804f74391321a346549294e75ea3e3e7ad7011e..f5653ada2f74ca29447ad81450e9218bc38a1eb2 100644 (file)
@@ -74,8 +74,7 @@ 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 long long)*((unsigned char *)key + count))
-            << (8 * count);
+    temp |= ((unsigned long long)*((unsigned char *)key + idx)) << (8 * count);
     ++count;
     if (count >= 8) {
       count = 0;