mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-08 08:23:34 -05:00
Fix autoconfig and memory allocation for heavy algo.
This commit is contained in:
@@ -27,8 +27,8 @@
|
||||
|
||||
|
||||
#include "crypto/CryptoNight.h"
|
||||
#include "crypto/CryptoNight_constants.h"
|
||||
#include "Mem.h"
|
||||
#include "xmrig.h"
|
||||
|
||||
|
||||
bool Mem::m_doubleHash = false;
|
||||
@@ -48,10 +48,13 @@ cryptonight_ctx *Mem::create(int threadId)
|
||||
}
|
||||
# endif
|
||||
|
||||
cryptonight_ctx *ctx = reinterpret_cast<cryptonight_ctx *>(&m_memory[MONERO_MEMORY - sizeof(cryptonight_ctx) * (threadId + 1)]);
|
||||
const size_t size = m_algo == xmrig::CRYPTONIGHT_HEAVY ? xmrig::cn_select_memory<xmrig::CRYPTONIGHT_HEAVY>()
|
||||
: xmrig::cn_select_memory<xmrig::CRYPTONIGHT>();
|
||||
|
||||
cryptonight_ctx *ctx = reinterpret_cast<cryptonight_ctx *>(&m_memory[size - sizeof(cryptonight_ctx) * (threadId + 1)]);
|
||||
|
||||
const int ratio = m_doubleHash ? 2 : 1;
|
||||
ctx->memory = &m_memory[MONERO_MEMORY * (threadId * ratio + 1)];
|
||||
ctx->memory = &m_memory[size * (threadId * ratio + 1)];
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user