Fixes for 32 bit gcc builds.

This commit is contained in:
XMRig 2018-03-14 16:58:39 +07:00
parent c0ca68e2db
commit f9a3315d75
3 changed files with 9 additions and 29 deletions

View file

@ -34,9 +34,9 @@ namespace xmrig {
class Id class Id
{ {
public: public:
inline Id() inline Id() :
m_data()
{ {
memset(m_data, 0, sizeof(m_data));
} }

View file

@ -58,29 +58,31 @@ static inline char hf_bin2hex(unsigned char c)
Job::Job() : Job::Job() :
m_nicehash(false), m_nicehash(false),
m_coin(),
m_algo(xmrig::ALGO_CRYPTONIGHT), m_algo(xmrig::ALGO_CRYPTONIGHT),
m_poolId(-2), m_poolId(-2),
m_threadId(-1), m_threadId(-1),
m_variant(xmrig::VARIANT_AUTO), m_variant(xmrig::VARIANT_AUTO),
m_size(0), m_size(0),
m_diff(0), m_diff(0),
m_target(0) m_target(0),
m_blob()
{ {
memset(m_coin, 0, sizeof(m_coin));
} }
Job::Job(int poolId, bool nicehash, int algo, int variant) : Job::Job(int poolId, bool nicehash, int algo, int variant) :
m_nicehash(nicehash), m_nicehash(nicehash),
m_coin(),
m_algo(algo), m_algo(algo),
m_poolId(poolId), m_poolId(poolId),
m_threadId(-1), m_threadId(-1),
m_variant(variant), m_variant(variant),
m_size(0), m_size(0),
m_diff(0), m_diff(0),
m_target(0) m_target(0),
m_blob()
{ {
memset(m_coin, 0, sizeof(m_coin));
} }
@ -113,11 +115,6 @@ bool Job::setBlob(const char *blob)
m_nicehash = true; m_nicehash = true;
} }
# ifdef XMRIG_PROXY_PROJECT
memset(m_rawBlob, 0, sizeof(m_rawBlob));
memcpy(m_rawBlob, blob, m_size * 2);
# endif
return true; return true;
} }
@ -154,11 +151,6 @@ bool Job::setTarget(const char *target)
return false; return false;
} }
# ifdef XMRIG_PROXY_PROJECT
memset(m_rawTarget, 0, sizeof(m_rawTarget));
memcpy(m_rawTarget, target, len);
# endif
m_diff = toDiff(m_target); m_diff = toDiff(m_target);
return true; return true;
} }

View file

@ -30,7 +30,6 @@
#include <stdint.h> #include <stdint.h>
#include "align.h"
#include "net/Id.h" #include "net/Id.h"
#include "xmrig.h" #include "xmrig.h"
@ -64,11 +63,6 @@ public:
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; } inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
inline void setThreadId(int threadId) { m_threadId = threadId; } inline void setThreadId(int threadId) { m_threadId = threadId; }
# ifdef XMRIG_PROXY_PROJECT
inline char *rawBlob() { return m_rawBlob; }
inline const char *rawTarget() const { return m_rawTarget; }
# endif
static bool fromHex(const char* in, unsigned int len, unsigned char* out); static bool fromHex(const char* in, unsigned int len, unsigned char* out);
static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast<uint32_t*>(blob + 39); } static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast<uint32_t*>(blob + 39); }
static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; } static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; }
@ -77,8 +71,6 @@ public:
bool operator==(const Job &other) const; bool operator==(const Job &other) const;
private: private:
VAR_ALIGN(16, uint8_t m_blob[84]); // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk.
bool m_nicehash; bool m_nicehash;
char m_coin[5]; char m_coin[5];
int m_algo; int m_algo;
@ -88,12 +80,8 @@ private:
size_t m_size; size_t m_size;
uint64_t m_diff; uint64_t m_diff;
uint64_t m_target; uint64_t m_target;
uint8_t m_blob[96]; // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk.
xmrig::Id m_id; xmrig::Id m_id;
# ifdef XMRIG_PROXY_PROJECT
VAR_ALIGN(16, char m_rawBlob[169]);
VAR_ALIGN(16, char m_rawTarget[17]);
# endif
}; };
#endif /* __JOB_H__ */ #endif /* __JOB_H__ */