Skip to content

Commit e391d0c

Browse files
committed
Bug correction in FNV-1a hash function.
1 parent 6f53842 commit e391d0c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/array_hash.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ struct str_hash {
7979

8080
std::size_t hash = init;
8181
for (std::size_t i = 0; i < key_size; ++i) {
82-
hash = (hash ^ key[i]) + (hash * multiplier);
82+
hash ^= key[i];
83+
hash *= multiplier;
8384
}
8485

8586
return hash;

0 commit comments

Comments
 (0)