Simplified cn/r code.

This commit is contained in:
XMRig 2019-06-02 23:38:02 +07:00
parent 36fcdf3f9d
commit 242ece7222
3 changed files with 17 additions and 16 deletions

View file

@ -24,6 +24,9 @@
*/
#include <limits>
#include "crypto/common/portable/mm_malloc.h"
#include "crypto/common/VirtualMemory.h"
#include "crypto/CryptoNight_constants.h"
@ -52,13 +55,9 @@ MemInfo Mem::create(cryptonight_ctx **ctx, xmrig::Algo algorithm, size_t count)
cryptonight_ctx *c = static_cast<cryptonight_ctx *>(_mm_malloc(sizeof(cryptonight_ctx), 4096));
c->memory = info.memory + (i * cn_select_memory(algorithm));
uint8_t* p = reinterpret_cast<uint8_t*>(xmrig::VirtualMemory::allocateExecutableMemory(0x4000));
c->generated_code = reinterpret_cast<cn_mainloop_fun_ms_abi>(p);
c->generated_code_double = reinterpret_cast<cn_mainloop_fun_ms_abi>(p + 0x2000);
c->generated_code = reinterpret_cast<cn_mainloop_fun_ms_abi>(xmrig::VirtualMemory::allocateExecutableMemory(0x4000));
c->generated_code_data.variant = xmrig::VARIANT_MAX;
c->generated_code_data.height = (uint64_t)(-1);
c->generated_code_double_data = c->generated_code_data;
c->generated_code_data.height = std::numeric_limits<uint64_t>::max();
ctx[i] = c;
}