From 2c4687431f978f02a3780e24b8b701d22aa32d9c Mon Sep 17 00:00:00 2001 From: Malte Skarupke Date: Sun, 15 Jul 2018 19:46:47 -0400 Subject: [PATCH] Fix that Fibonacci hashing doesn't work with a size of 1. It now just rounds up to size 2. --- flat_hash_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flat_hash_map.hpp b/flat_hash_map.hpp index 33fc221..a8723ee 100644 --- a/flat_hash_map.hpp +++ b/flat_hash_map.hpp @@ -1278,7 +1278,7 @@ struct fibonacci_hash_policy int8_t next_size_over(size_t & size) const { - size = detailv3::next_power_of_two(size); + size = std::max(size_t(2), detailv3::next_power_of_two(size)); return 64 - detailv3::log2(size); } void commit(int8_t shift)