Update robin_hood to 3.11.3.

This commit is contained in:
Bartosz Taudul 2021-12-01 21:44:56 +01:00
parent ce7faf99c9
commit 1a0cf3ff46
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -36,18 +36,18 @@
// see https://semver.org/ // see https://semver.org/
#define ROBIN_HOOD_VERSION_MAJOR 3 // for incompatible API changes #define ROBIN_HOOD_VERSION_MAJOR 3 // for incompatible API changes
#define ROBIN_HOOD_VERSION_MINOR 11 // for adding functionality in a backwards-compatible manner #define ROBIN_HOOD_VERSION_MINOR 11 // for adding functionality in a backwards-compatible manner
#define ROBIN_HOOD_VERSION_PATCH 1 // for backwards-compatible bug fixes #define ROBIN_HOOD_VERSION_PATCH 3 // for backwards-compatible bug fixes
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <functional> #include <functional>
#include <limits>
#include <memory> // only to support hash of smart pointers #include <memory> // only to support hash of smart pointers
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <limits>
#if __cplusplus >= 201703L #if __cplusplus >= 201703L
# include <string_view> # include <string_view>
#endif #endif
@ -2427,15 +2427,14 @@ private:
<< (static_cast<double>(mNumElements) * 100.0 / << (static_cast<double>(mNumElements) * 100.0 /
(static_cast<double>(mMask) + 1))) (static_cast<double>(mMask) + 1)))
nextHashMultiplier();
if (mNumElements * 2 < calcMaxNumElementsAllowed(mMask + 1)) { if (mNumElements * 2 < calcMaxNumElementsAllowed(mMask + 1)) {
// we have to resize, even though there would still be plenty of space left! // we have to resize, even though there would still be plenty of space left!
// Try to rehash instead. Delete freed memory so we don't steadyily increase mem in case // Try to rehash instead. Delete freed memory so we don't steadyily increase mem in case
// we have to rehash a few times // we have to rehash a few times
nextHashMultiplier();
rehashPowerOfTwo(mMask + 1, true); rehashPowerOfTwo(mMask + 1, true);
} else { } else {
// Each resize use a different hash so we don't so easily overflow. // we've reached the capacity of the map, so the hash seems to work nice. Keep using it.
// Make sure we only have odd numbers, so that the multiplication is reversible!
rehashPowerOfTwo((mMask + 1) * 2, false); rehashPowerOfTwo((mMask + 1) * 2, false);
} }
return true; return true;