mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 16:40:39 +08:00
fix error when compiling without NDEBUG
This commit is contained in:
Vendored
+24
@@ -2151,6 +2151,30 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
constexpr size_t Group::kWidth;
|
||||
|
||||
// Returns "random" seed.
|
||||
inline size_t RandomSeed()
|
||||
{
|
||||
#if PHMAP_HAVE_THREAD_LOCAL
|
||||
static thread_local size_t counter = 0;
|
||||
size_t value = ++counter;
|
||||
#else // PHMAP_HAVE_THREAD_LOCAL
|
||||
static std::atomic<size_t> counter(0);
|
||||
size_t value = counter.fetch_add(1, std::memory_order_relaxed);
|
||||
#endif // PHMAP_HAVE_THREAD_LOCAL
|
||||
return value ^ static_cast<size_t>(reinterpret_cast<uintptr_t>(&counter));
|
||||
}
|
||||
|
||||
bool ShouldInsertBackwards(size_t hash, ctrl_t* ctrl)
|
||||
{
|
||||
// To avoid problems with weak hashes and single bit tests, we use % 13.
|
||||
// TODO(kfm,sbenza): revisit after we do unconditional mixing
|
||||
return (H1(hash, ctrl) ^ RandomSeed()) % 13 > 6;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
template <size_t N,
|
||||
|
||||
Reference in New Issue
Block a user