From aabdff2cc9b21e71ac15c972d9d4ffebc8db0210 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 6 Feb 2019 00:38:55 +0700 Subject: [PATCH] Fixed floating-point rounding, resolved conflict between cn/2 and cn/gpu. Thanks @SChernykh. --- src/crypto/CryptoNight_arm.h | 2 ++ src/crypto/CryptoNight_x86.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/crypto/CryptoNight_arm.h b/src/crypto/CryptoNight_arm.h index 456b5d744..add7f7464 100644 --- a/src/crypto/CryptoNight_arm.h +++ b/src/crypto/CryptoNight_arm.h @@ -586,6 +586,8 @@ inline void cryptonight_single_hash_gpu(const uint8_t *__restrict__ input, size_ xmrig::keccak(input, size, ctx[0]->state); cn_explode_scratchpad_gpu(ctx[0]->state, ctx[0]->memory); + fesetround(FE_TONEAREST); + cn_gpu_inner_arm(ctx[0]->state, ctx[0]->memory); cn_implode_scratchpad((__m128i*) ctx[0]->memory, (__m128i*) ctx[0]->state); diff --git a/src/crypto/CryptoNight_x86.h b/src/crypto/CryptoNight_x86.h index 2d1aef0d6..1ae7b795b 100644 --- a/src/crypto/CryptoNight_x86.h +++ b/src/crypto/CryptoNight_x86.h @@ -616,6 +616,12 @@ inline void cryptonight_single_hash_gpu(const uint8_t *__restrict__ input, size_ xmrig::keccak(input, size, ctx[0]->state); cn_explode_scratchpad_gpu(ctx[0]->state, ctx[0]->memory); +# ifdef _MSC_VER + _control87(RC_NEAR, MCW_RC); +# else + fesetround(FE_TONEAREST); +# endif + if (xmrig::Cpu::info()->hasAVX2()) { cn_gpu_inner_avx(ctx[0]->state, ctx[0]->memory); } else {