mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-21 04:48:14 -05:00
nonce iteration optimization
efficient and correct nonce iteration without duplicates
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
@@ -49,18 +50,18 @@ public:
|
||||
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); }
|
||||
static inline void pause(bool paused) { m_paused = paused; }
|
||||
static inline void reset(uint8_t index) { m_nonces[index] = 0; }
|
||||
static inline void stop(Backend backend) { m_sequence[backend] = 0; }
|
||||
static inline void touch(Backend backend) { m_sequence[backend]++; }
|
||||
|
||||
static uint32_t next(uint8_t index, uint32_t nonce, uint32_t reserveCount, bool nicehash, bool *ok = nullptr);
|
||||
static void reset(uint8_t index);
|
||||
static bool next(uint8_t index, uint32_t *nonce, uint32_t reserveCount, bool nicehash, size_t nonceSize);
|
||||
static void stop();
|
||||
static void touch();
|
||||
|
||||
private:
|
||||
static std::atomic<bool> m_paused;
|
||||
static std::atomic<uint64_t> m_sequence[MAX];
|
||||
static uint32_t m_nonces[2];
|
||||
static std::atomic<uint64_t> m_nonces[2];
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user