summaryrefslogtreecommitdiffhomepage
path: root/misc/benchmarks/external/emhash/hash_table7.hpp
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-01-05 22:54:46 +0100
committerTyge Lovset <[email protected]>2023-01-05 22:54:46 +0100
commitdd1ac09cd54e2632ec9d272ec578cde67a5edd01 (patch)
treea7cccc604a3822a67348333dfaf42dfcf14796f3 /misc/benchmarks/external/emhash/hash_table7.hpp
parenta8a6b363ee13112219306b28a5c2f35203477a5a (diff)
downloadSTC-modified-dd1ac09cd54e2632ec9d272ec578cde67a5edd01.tar.gz
STC-modified-dd1ac09cd54e2632ec9d272ec578cde67a5edd01.zip
Updated external benchmark hash maps to latest, and improved example lower_bound.c
Diffstat (limited to 'misc/benchmarks/external/emhash/hash_table7.hpp')
-rw-r--r--misc/benchmarks/external/emhash/hash_table7.hpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/misc/benchmarks/external/emhash/hash_table7.hpp b/misc/benchmarks/external/emhash/hash_table7.hpp
index fdc33fe1..ced0f1d0 100644
--- a/misc/benchmarks/external/emhash/hash_table7.hpp
+++ b/misc/benchmarks/external/emhash/hash_table7.hpp
@@ -171,7 +171,7 @@ static_assert((int)INACTIVE < 0, "INACTIVE must negative (to int)");
#endif
//count the leading zero bit
-inline static int CTZ(size_t n)
+static int CTZ(size_t n)
{
#if defined(__x86_64__) || defined(_WIN32) || (__BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
@@ -418,7 +418,7 @@ public:
private:
void goto_next_element()
{
- if (EMH_LIKELY(_bmask != 0)) {
+ if (_bmask != 0) {
_bucket = _from + CTZ(_bmask);
return;
}
@@ -502,7 +502,7 @@ public:
void goto_next_element()
{
_bmask &= _bmask - 1;
- if (EMH_LIKELY(_bmask != 0)) {
+ if (_bmask != 0) {
_bucket = _from + CTZ(_bmask);
return;
}
@@ -718,30 +718,30 @@ public:
return {this, bucket, true};
}
- const_iterator begin() const noexcept { return cbegin(); }
+ inline const_iterator begin() const noexcept { return cbegin(); }
- iterator end() noexcept { return {this, _num_buckets}; }
- const_iterator cend() const { return {this, _num_buckets}; }
- const_iterator end() const { return cend(); }
+ inline iterator end() noexcept { return {this, _num_buckets}; }
+ inline const_iterator cend() const { return {this, _num_buckets}; }
+ inline const_iterator end() const { return cend(); }
- size_type size() const { return _num_filled; }
- bool empty() const { return _num_filled == 0; }
+ inline size_type size() const { return _num_filled; }
+ inline bool empty() const { return _num_filled == 0; }
- size_type bucket_count() const { return _num_buckets; }
- float load_factor() const { return static_cast<float>(_num_filled) / (_mask + 1); }
+ inline size_type bucket_count() const { return _num_buckets; }
+ inline float load_factor() const { return static_cast<float>(_num_filled) / (_mask + 1); }
- HashT& hash_function() const { return _hasher; }
- EqT& key_eq() const { return _eq; }
+ inline HashT& hash_function() const { return _hasher; }
+ inline EqT& key_eq() const { return _eq; }
- void max_load_factor(float mlf)
+ inline void max_load_factor(float mlf)
{
if (mlf < 0.999f && mlf > EMH_MIN_LOAD_FACTOR)
_mlf = (uint32_t)((1 << 27) / mlf);
}
- constexpr float max_load_factor() const { return (1 << 27) / (float)_mlf; }
- constexpr size_type max_size() const { return 1ull << (sizeof(size_type) * 8 - 1); }
- constexpr size_type max_bucket_count() const { return max_size(); }
+ inline constexpr float max_load_factor() const { return (1 << 27) / (float)_mlf; }
+ inline constexpr size_type max_size() const { return 1ull << (sizeof(size_type) * 8 - 1); }
+ inline constexpr size_type max_bucket_count() const { return max_size(); }
size_type bucket_main() const
{
@@ -913,25 +913,25 @@ public:
// ------------------------------------------------------------
template<typename Key = KeyT>
- iterator find(const Key& key, size_t key_hash) noexcept
+ inline iterator find(const Key& key, size_t key_hash) noexcept
{
return {this, find_filled_hash(key, key_hash)};
}
template<typename Key = KeyT>
- const_iterator find(const Key& key, size_t key_hash) const noexcept
+ inline const_iterator find(const Key& key, size_t key_hash) const noexcept
{
return {this, find_filled_hash(key, key_hash)};
}
template<typename Key=KeyT>
- iterator find(const Key& key) noexcept
+ inline iterator find(const Key& key) noexcept
{
return {this, find_filled_bucket(key)};
}
template<typename Key = KeyT>
- const_iterator find(const Key& key) const noexcept
+ inline const_iterator find(const Key& key) const noexcept
{
return {this, find_filled_bucket(key)};
}
@@ -953,13 +953,13 @@ public:
}
template<typename Key = KeyT>
- bool contains(const Key& key) const noexcept
+ inline bool contains(const Key& key) const noexcept
{
return find_filled_bucket(key) != _num_buckets;
}
template<typename Key = KeyT>
- size_type count(const Key& key) const noexcept
+ inline size_type count(const Key& key) const noexcept
{
return find_filled_bucket(key) != _num_buckets ? 1 : 0;
}
@@ -1120,23 +1120,23 @@ public:
#endif
template<typename K, typename V>
- size_type insert_unique(K&& key, V&& val)
+ inline size_type insert_unique(K&& key, V&& val)
{
return do_insert_unqiue(std::forward<K>(key), std::forward<V>(val));
}
- size_type insert_unique(value_type&& value)
+ inline size_type insert_unique(value_type&& value)
{
return do_insert_unqiue(std::move(value.first), std::move(value.second));
}
- size_type insert_unique(const value_type& value)
+ inline size_type insert_unique(const value_type& value)
{
return do_insert_unqiue(value.first, value.second);
}
template<typename K, typename V>
- inline size_type do_insert_unqiue(K&& key, V&& val)
+ size_type do_insert_unqiue(K&& key, V&& val)
{
check_expand_need();
auto bucket = find_unique_bucket(key);
@@ -1148,7 +1148,7 @@ public:
std::pair<iterator, bool> insert_or_assign(KeyT&& key, ValueT&& val) { return do_assign(std::move(key), std::forward<ValueT>(val)); }
template <typename... Args>
- inline std::pair<iterator, bool> emplace(Args&&... args) noexcept
+ std::pair<iterator, bool> emplace(Args&&... args) noexcept
{
check_expand_need();
return do_insert(std::forward<Args>(args)...);
@@ -1177,7 +1177,7 @@ public:
}
template <class... Args>
- inline size_type emplace_unique(Args&&... args) noexcept
+ size_type emplace_unique(Args&&... args) noexcept
{
return insert_unique(std::forward<Args>(args)...);
}
@@ -1674,7 +1674,7 @@ private:
#endif
const auto qmask = _mask / SIZE_BIT;
- if (1) {
+ if (0) {
const size_type step = (main_bucket - SIZE_BIT / 4) & qmask;
const auto bmask3 = *((size_t*)_bitmask + step);
if (bmask3 != 0)
@@ -1682,7 +1682,7 @@ private:
}
for (; ;) {
- auto& _last = EMH_BUCKET(_pairs, _num_buckets);
+ auto& _last = EMH_BUCKET(_pairs, _num_buckets);
const auto bmask2 = *((size_t*)_bitmask + _last);
if (bmask2 != 0)
return _last * SIZE_BIT + CTZ(bmask2);
@@ -1779,7 +1779,7 @@ private:
#if EMH_INT_HASH
static constexpr uint64_t KC = UINT64_C(11400714819323198485);
- static inline uint64_t hash64(uint64_t key)
+ inline uint64_t hash64(uint64_t key)
{
#if __SIZEOF_INT128__ && EMH_INT_HASH == 1
__uint128_t r = key; r *= KC;