From a8de81a51b17b710d975bcd79b85db9a9d5d82fc Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 9 Jul 2018 00:23:27 +0700 Subject: [PATCH] #714 Simplify cn-heavy/xhv. --- src/crypto/CryptoNight_x86.h | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/crypto/CryptoNight_x86.h b/src/crypto/CryptoNight_x86.h index 8ab65023..7c8adc69 100644 --- a/src/crypto/CryptoNight_x86.h +++ b/src/crypto/CryptoNight_x86.h @@ -485,11 +485,10 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si ((int64_t*)&l0[idx0 & MASK])[0] = n ^ q; if (VARIANT == xmrig::VARIANT_XHV) { - idx0 = (~d) ^ q; - } - else { - idx0 = d ^ q; + d = ~d; } + + idx0 = d ^ q; } } @@ -600,11 +599,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si ((int64_t*)&l0[idx0 & MASK])[0] = n ^ q; if (VARIANT == xmrig::VARIANT_XHV) { - idx0 = (~d) ^ q; - } - else { - idx0 = d ^ q; + d = ~d; } + + idx0 = d ^ q; } cl = ((uint64_t*) &l1[idx1 & MASK])[0]; @@ -640,11 +638,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si ((int64_t*)&l1[idx1 & MASK])[0] = n ^ q; if (VARIANT == xmrig::VARIANT_XHV) { - idx1 = (~d) ^ q; - } - else { - idx1 = d ^ q; + d = ~d; } + + idx1 = d ^ q; } } @@ -690,7 +687,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si lo = __umul128(idx, EXTRACT64(b), &hi); \ a = _mm_add_epi64(a, _mm_set_epi64x(lo, hi)); \ \ - if (IS_MONERO) { \ + if (IS_MONERO) { \ _mm_store_si128(ptr, _mm_xor_si128(a, mc)); \ \ if (VARIANT == xmrig::VARIANT_IPBC) { \ @@ -709,11 +706,10 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si int64_t q = n / (d | 0x5); \ ((int64_t*)&l[idx & MASK])[0] = n ^ q; \ if (VARIANT == xmrig::VARIANT_XHV) { \ - idx = (~d) ^ q; \ - } \ - else { \ - idx = d ^ q; \ + d = ~d; \ } \ + \ + idx = d ^ q; \ }