From 98494420c5d9fbf10045faa7b6dc23aa1e0081d1 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 18 Jan 2022 20:52:05 +0200 Subject: [PATCH] Add a BOOST_ASSERT to mix64_policy to check that the bucket_count is a power of two --- include/boost/unordered/detail/implementation.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index a7bb863c..2de4c9a8 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -2018,6 +2018,7 @@ namespace boost { static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) { + BOOST_ASSERT( boost::core::has_single_bit( bucket_count ) ); return hash & (bucket_count - 1); }