mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-30 00:50:38 +08:00
This reverts commit 3f02d81926.
This commit is contained in:
Vendored
+5
-15
@@ -1441,17 +1441,6 @@ public:
|
||||
slot_type** slot_;
|
||||
};
|
||||
|
||||
struct fpi_result
|
||||
{
|
||||
~fpi_result() { if (second) set->set_ctrl(first, H2(hashval)); }
|
||||
|
||||
raw_hash_set *set;
|
||||
size_t hashval;
|
||||
size_t first;
|
||||
bool second;
|
||||
};
|
||||
|
||||
|
||||
template <class K = key_type, class F>
|
||||
iterator lazy_emplace(const key_arg<K>& key, F&& f) {
|
||||
auto res = find_or_prepare_insert(key);
|
||||
@@ -2093,7 +2082,7 @@ private:
|
||||
|
||||
protected:
|
||||
template <class K>
|
||||
fpi_result find_or_prepare_insert(const K& key, size_t hashval) {
|
||||
std::pair<size_t, bool> find_or_prepare_insert(const K& key, size_t hashval) {
|
||||
auto seq = probe(hashval);
|
||||
while (true) {
|
||||
Group g{ctrl_ + seq.offset()};
|
||||
@@ -2101,16 +2090,16 @@ protected:
|
||||
if (PHMAP_PREDICT_TRUE(PolicyTraits::apply(
|
||||
EqualElement<K>{key, eq_ref()},
|
||||
PolicyTraits::element(slots_ + seq.offset((size_t)i)))))
|
||||
return {this, hashval, seq.offset((size_t)i), false};
|
||||
return {seq.offset((size_t)i), false};
|
||||
}
|
||||
if (PHMAP_PREDICT_TRUE(g.MatchEmpty())) break;
|
||||
seq.next();
|
||||
}
|
||||
return {this, hashval, prepare_insert(hashval), true};
|
||||
return {prepare_insert(hashval), true};
|
||||
}
|
||||
|
||||
template <class K>
|
||||
fpi_result find_or_prepare_insert(const K& key) {
|
||||
std::pair<size_t, bool> find_or_prepare_insert(const K& key) {
|
||||
return find_or_prepare_insert(key, this->hash(key));
|
||||
}
|
||||
|
||||
@@ -2123,6 +2112,7 @@ protected:
|
||||
}
|
||||
++size_;
|
||||
growth_left() -= IsEmpty(ctrl_[target.offset]);
|
||||
set_ctrl(target.offset, H2(hashval));
|
||||
infoz_.RecordInsert(hashval, target.probe_length);
|
||||
return target.offset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user