From 1e57c08686123d34b6161911ff786603f5af2d77 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Mon, 28 Nov 2022 17:58:15 +0100 Subject: [PATCH] fourth attempt --- include/boost/unordered/detail/foa.hpp | 27 ++++++++------------------ 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/include/boost/unordered/detail/foa.hpp b/include/boost/unordered/detail/foa.hpp index 01e3ba34..d05752c8 100644 --- a/include/boost/unordered/detail/foa.hpp +++ b/include/boost/unordered/detail/foa.hpp @@ -689,46 +689,35 @@ struct pow2_size_policy // of performance std::size_t used_bits_=n<=2?1:((std::size_t)(boost::core::bit_width(n-1))); - std::size_t used_hi_=used_bits_>=10?(5-(used_bits_%6))*2:0; - std::size_t used_hi_mask_=(std::size_t(1)<>unused_bits_)&~used_hi_mask_)|(hash&used_hi_mask_); + return (hash<>shift_right(size_index_); } private: static constexpr std::size_t total_bits=sizeof(std::size_t)*CHAR_BIT; - static inline std::size_t used_hi_mask(std::size_t size_index_) + static inline std::size_t shift_left(std::size_t size_index_) { return size_index_>>16; } - static inline std::size_t used_hi(std::size_t size_index_) + static inline std::size_t shift_right(std::size_t size_index_) { - return (size_index_>>8)&0xffu; - } - - static inline std::size_t unused_bits(std::size_t size_index_) - { - return size_index_&0xffu; + return size_index_&0xffffu; } }; #endif