Skip to content

Commit 2c46874

Browse files
committed
Fix that Fibonacci hashing doesn't work with a size of 1. It now just rounds up to size 2.
1 parent 812aede commit 2c46874

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flat_hash_map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ struct fibonacci_hash_policy
12781278

12791279
int8_t next_size_over(size_t & size) const
12801280
{
1281-
size = detailv3::next_power_of_two(size);
1281+
size = std::max(size_t(2), detailv3::next_power_of_two(size));
12821282
return 64 - detailv3::log2(size);
12831283
}
12841284
void commit(int8_t shift)

0 commit comments

Comments
 (0)