From a01b4d05668572d41be3bf68b843b5b7d251fe8a Mon Sep 17 00:00:00 2001 From: XMRig Date: Tue, 13 Mar 2018 17:50:09 +0700 Subject: [PATCH] Simplify variant selection. --- src/net/Job.cpp | 21 --------------------- src/net/Job.h | 3 ++- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/net/Job.cpp b/src/net/Job.cpp index b9d7372c0..8b1966aa3 100644 --- a/src/net/Job.cpp +++ b/src/net/Job.cpp @@ -27,7 +27,6 @@ #include "net/Job.h" -#include "xmrig.h" static inline unsigned char hf_hex2bin(char c, bool &err) @@ -165,26 +164,6 @@ bool Job::setTarget(const char *target) } -int Job::variant() const -{ - if (m_variant != xmrig::VARIANT_AUTO) { - return m_variant; - } - - const uint8_t version = m_blob[0]; - -# if !defined(XMRIG_NO_AEON) - if (m_algo == xmrig::ALGO_CRYPTONIGHT) { - return version > 6 ? 1 : 0; - } - - return version > 1 ? 1 : 0; -# else - return version > 6 ? 1 : 0; -# endif -} - - void Job::setCoin(const char *coin) { if (!coin || strlen(coin) > 4) { diff --git a/src/net/Job.h b/src/net/Job.h index 28d5e111b..545eaa888 100644 --- a/src/net/Job.h +++ b/src/net/Job.h @@ -32,6 +32,7 @@ #include "align.h" #include "net/Id.h" +#include "xmrig.h" class Job @@ -43,7 +44,6 @@ public: bool setBlob(const char *blob); bool setTarget(const char *target); - int variant() const; void setCoin(const char *coin); void setVariant(int variant); @@ -56,6 +56,7 @@ public: inline const xmrig::Id &id() const { return m_id; } inline int poolId() const { return m_poolId; } inline int threadId() const { return m_threadId; } + inline int variant() const { return (m_variant == xmrig::VARIANT_AUTO ? (m_blob[0] > 6 ? 1 : 0) : m_variant); } inline size_t size() const { return m_size; } inline uint32_t *nonce() { return reinterpret_cast(m_blob + 39); } inline uint32_t diff() const { return (uint32_t) m_diff; }