From 7717ff01a11a8fdd985cdd322c7c5608c003f50d Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 18 Jan 2022 20:40:23 +0200 Subject: [PATCH] Use bit_ceil and bit_floor in mix64_policy --- .../boost/unordered/detail/implementation.hpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index fc83e739..a7bb863c 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -2024,25 +2025,12 @@ namespace boost { { if (min <= 4) return 4; - --min; - min |= min >> 1; - min |= min >> 2; - min |= min >> 4; - min |= min >> 8; - min |= min >> 16; - min |= min >> 32; - return min + 1; + return boost::core::bit_ceil(min); } static inline SizeT prev_bucket_count(SizeT max) { - max |= max >> 1; - max |= max >> 2; - max |= max >> 4; - max |= max >> 8; - max |= max >> 16; - max |= max >> 32; - return (max >> 1) + 1; + return boost::core::bit_floor(max); } };