Better v1 PoW implementation, added variant option.

This commit is contained in:
XMRig 2018-03-12 22:29:44 +07:00
parent 83e5832bc1
commit aec31c43c0
19 changed files with 236 additions and 116 deletions

View file

@ -29,28 +29,22 @@
// VARIANT ALTERATIONS
#define VARIANT1_INIT(part) \
uint64_t tweak1_2_##part = 0; \
if (MONERO) { \
if (version > 6) { \
tweak1_2_##part = (*reinterpret_cast<const uint64_t*>(reinterpret_cast<const uint8_t*>(input) + 35 + part * size) ^ \
*(reinterpret_cast<const uint64_t*>(ctx->state##part) + 24)); \
} \
if (VARIANT > 0) { \
tweak1_2_##part = (*reinterpret_cast<const uint64_t*>(reinterpret_cast<const uint8_t*>(input) + 35 + part * size) ^ \
*(reinterpret_cast<const uint64_t*>(ctx->state##part) + 24)); \
}
#define VARIANT1_1(p) \
if (MONERO) { \
if (version > 6) { \
const uint8_t tmp = reinterpret_cast<const uint8_t*>(p)[11]; \
static const uint32_t table = 0x75310; \
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \
((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \
} \
if (VARIANT > 0) { \
const uint8_t tmp = reinterpret_cast<const uint8_t*>(p)[11]; \
static const uint32_t table = 0x75310; \
const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \
((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \
}
#define VARIANT1_2(p, part) \
if (MONERO) { \
if (version > 6) { \
(p) ^= tweak1_2_##part; \
} \
if (VARIANT > 0) { \
(p) ^= tweak1_2_##part; \
}