Update base.

This commit is contained in:
XMRig 2020-04-29 14:17:33 +07:00
parent b38046db46
commit 46e49cde0b
No known key found for this signature in database
GPG key ID: 446A53638BE94409
40 changed files with 162 additions and 244 deletions

View file

@ -1,10 +1,4 @@
/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
@ -48,10 +42,10 @@ public:
}
inline static void *ptr(uintptr_t id) { return reinterpret_cast<void *>(id); }
inline void *ptr(uintptr_t id) { return reinterpret_cast<void *>(id); }
inline TYPE *get(const void *id) const { return get(reinterpret_cast<uintptr_t>(id)); }
inline TYPE *get(const void *id) const { return get(reinterpret_cast<uintptr_t>(id)); }
inline TYPE *get(uintptr_t id) const
{
assert(m_data.count(id) > 0);
@ -63,19 +57,16 @@ public:
}
inline void remove(const void *id) { delete release(reinterpret_cast<uintptr_t>(id)); }
inline void remove(uintptr_t id) { delete release(id); }
inline void remove(const void *id) { delete release(reinterpret_cast<uintptr_t>(id)); }
inline void remove(uintptr_t id) { delete release(id); }
inline TYPE *release(const void *id) { release(reinterpret_cast<uintptr_t>(id)); }
inline TYPE *release(const void *id) { return release(reinterpret_cast<uintptr_t>(id)); }
inline TYPE *release(uintptr_t id)
{
TYPE *obj = get(id);
auto obj = get(id);
if (obj != nullptr) {
auto it = m_data.find(id);
if (it != m_data.end()) {
m_data.erase(it);
}
m_data.erase(id);
}
return obj;
@ -84,7 +75,7 @@ public:
private:
std::map<uintptr_t, TYPE *> m_data;
uint64_t m_counter = 0;
uintptr_t m_counter = 0;
};