From bcfd9edaa576fa83a8963c07bfc8084bc40cd98b Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sat, 27 Mar 2021 22:21:01 +0100 Subject: [PATCH] Optimized cn-heavy - Remove unnecessary type conversion when doing `idx0 = d ^ q;` - Saves 1 CPU cycle in the main loop - 0.2% speedup on Ryzen 5 5600X, results on other CPUs may vary --- src/crypto/cn/CryptoNight_x86.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/cn/CryptoNight_x86.h b/src/crypto/cn/CryptoNight_x86.h index 7cc4e062f..4dc886d26 100644 --- a/src/crypto/cn/CryptoNight_x86.h +++ b/src/crypto/cn/CryptoNight_x86.h @@ -739,7 +739,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si # ifdef XMRIG_ALGO_CN_HEAVY if (props.isHeavy()) { int64_t n = ((int64_t*)&l0[interleaved_index(idx0 & MASK)])[0]; - int32_t d = ((int32_t*)&l0[interleaved_index(idx0 & MASK)])[2]; + int64_t d = ((int32_t*)&l0[interleaved_index(idx0 & MASK)])[2]; int64_t q = n / (d | 0x5); ((int64_t*)&l0[interleaved_index(idx0 & MASK)])[0] = n ^ q;