fix error when compiling without NDEBUG

This commit is contained in:
greg
2019-03-19 17:58:24 -04:00
parent 731988de1b
commit 2720a7108c
2 changed files with 29 additions and 0 deletions
Vendored
+5
View File
@@ -23,6 +23,11 @@ This repository aims to provide an set of excellent hash map implementations, wi
- Not yet **Tested** ~~on Windows (vs2010-2015, g++), linux (g++, clang++) and MacOS (clang++)~~.
## Installation
Copy the parallel_hashmap directory to your project. That's all.
> The CMakeLists.txt are provided for building the tests and examples.
## Example
+24
View File
@@ -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,