[ox/std] Make HashMap::expand move new Pair Vector instead of copy
This commit is contained in:
parent
81f2865fcc
commit
ff76d2f453
6
deps/ox/src/ox/std/hashmap.hpp
vendored
6
deps/ox/src/ox/std/hashmap.hpp
vendored
@ -213,17 +213,17 @@ const Vector<K> &HashMap<K, T>::keys() const noexcept {
|
||||
template<typename K, typename T>
|
||||
void HashMap<K, T>::expand() {
|
||||
Vector<Pair*> r;
|
||||
for (std::size_t i = 0; i < m_keys.size(); i++) {
|
||||
for (std::size_t i = 0; i < m_keys.size(); ++i) {
|
||||
auto k = m_keys[i];
|
||||
access(r, k) = access(m_pairs, k);
|
||||
}
|
||||
m_pairs = r;
|
||||
m_pairs = std::move(r);
|
||||
}
|
||||
|
||||
template<typename K, typename T>
|
||||
uint64_t HashMap<K, T>::hash(K k, int len) noexcept {
|
||||
uint64_t sum = 1;
|
||||
for (int i = 0; i < len && k[i]; i++) {
|
||||
for (int i = 0; i < len && k[i]; ++i) {
|
||||
sum += ((sum + k[i]) * 7) * sum;
|
||||
}
|
||||
return sum;
|
||||
|
Loading…
Reference in New Issue
Block a user