From 25a280d6a19f9a4ada3a35ee0081a013f625aaea Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Wed, 31 Aug 2022 20:44:50 +0000 Subject: [PATCH] Dict: use std::log2, remove custom Log2 method --- src/Dict.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Dict.h b/src/Dict.h index 951d7baf24..36f5f68667 100644 --- a/src/Dict.h +++ b/src/Dict.h @@ -3,6 +3,7 @@ #pragma once #include +#include #include #include #include @@ -456,7 +457,7 @@ public: { // If an initial size is speicified, init the table right away. Otherwise wait until the // first insertion to init. - log2_buckets = Log2(initial_size); + log2_buckets = static_cast(std::log2(initial_size)); Init(); } @@ -941,14 +942,6 @@ private: } // bucket math - int Log2(int num) const - { - int i = 0; - while ( num >>= 1 ) - i++; - return i; - } - int ThresholdEntries() const { // Increase the size of the dictionary when it is 75% full. However, when the dictionary