mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 12:09:22 +00:00
Nonce: refactor static init
This commit is contained in:
parent
116fb3d3f9
commit
7bdeba4d08
2 changed files with 2 additions and 18 deletions
|
@ -28,28 +28,14 @@
|
|||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
std::atomic<bool> Nonce::m_paused;
|
||||
std::atomic<uint64_t> Nonce::m_sequence[Nonce::MAX];
|
||||
std::atomic<bool> Nonce::m_paused = {true};
|
||||
std::atomic<uint64_t> Nonce::m_sequence[Nonce::MAX] = { {1}, {1}, {1} };
|
||||
std::atomic<uint64_t> Nonce::m_nonces[2] = { {0}, {0} };
|
||||
|
||||
|
||||
static Nonce nonce;
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::Nonce::Nonce()
|
||||
{
|
||||
m_paused = true;
|
||||
|
||||
for (auto &i : m_sequence) {
|
||||
i = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Nonce::next(uint8_t index, uint32_t *nonce, uint32_t reserveCount, uint64_t mask)
|
||||
{
|
||||
mask &= 0x7FFFFFFFFFFFFFFFULL;
|
||||
|
|
|
@ -43,8 +43,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
Nonce();
|
||||
|
||||
static inline bool isOutdated(Backend backend, uint64_t sequence) { return m_sequence[backend].load(std::memory_order_relaxed) != sequence; }
|
||||
static inline bool isPaused() { return m_paused.load(std::memory_order_relaxed); }
|
||||
static inline uint64_t sequence(Backend backend) { return m_sequence[backend].load(std::memory_order_relaxed); }
|
||||
|
|
Loading…
Reference in a new issue