Simplify variant selection.

This commit is contained in:
XMRig 2018-03-13 17:50:09 +07:00
parent 07f0a107d3
commit a01b4d0566
2 changed files with 2 additions and 22 deletions

View file

@ -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) {

View file

@ -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<uint32_t*>(m_blob + 39); }
inline uint32_t diff() const { return (uint32_t) m_diff; }