summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
diff options
context:
space:
mode:
authorfireice-uk <fireice-uk@users.noreply.github.com>2018-04-09 16:41:32 +0100
committerGitHub <noreply@github.com>2018-04-09 16:41:32 +0100
commitcec27c69419fd683f14191912b600b238737df29 (patch)
tree626314a2add2f76649ca31c4b7e0a731f6d80f9b /xmrstak/backend/cpu/crypto/cryptonight_common.cpp
parented6513aa5f0c652bb9f7864da892e7c1df02230b (diff)
parent1b18f598aa1190a0e6126ed2c70e052e9403d180 (diff)
downloadxmr-stak-cec27c69419fd683f14191912b600b238737df29.zip
xmr-stak-cec27c69419fd683f14191912b600b238737df29.tar.gz
Merge pull request #1373 from psychocrypt/topic-maxScratchpad
refactor scratchpad creation
Diffstat (limited to 'xmrstak/backend/cpu/crypto/cryptonight_common.cpp')
-rw-r--r--xmrstak/backend/cpu/crypto/cryptonight_common.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
index 17fa24b..ac696dd 100644
--- a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
+++ b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp
@@ -35,6 +35,7 @@ extern "C"
#include "xmrstak/jconf.hpp"
#include <stdio.h>
#include <stdlib.h>
+#include <algorithm>
#ifdef __GNUC__
#include <mm_malloc.h>
@@ -202,7 +203,10 @@ size_t cryptonight_init(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg)
cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg)
{
- size_t hashMemSize = cn_select_memory(::jconf::inst()->GetMiningAlgo());
+ size_t hashMemSize = std::max(
+ cn_select_memory(::jconf::inst()->GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ );
cryptonight_ctx* ptr = (cryptonight_ctx*)_mm_malloc(sizeof(cryptonight_ctx), 4096);
@@ -278,7 +282,10 @@ cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, al
void cryptonight_free_ctx(cryptonight_ctx* ctx)
{
- size_t hashMemSize = cn_select_memory(::jconf::inst()->GetMiningAlgo());
+ size_t hashMemSize = std::max(
+ cn_select_memory(::jconf::inst()->GetMiningAlgo()),
+ cn_select_memory(::jconf::inst()->GetMiningAlgoRoot())
+ );
if(ctx->ctx_info[0] != 0)
{
OpenPOWER on IntegriCloud