Implement low power mode (double hash).

This commit is contained in:
XMRig 2017-05-01 03:49:05 +03:00
parent caf7cda1d5
commit 1678dc1d6d
18 changed files with 686 additions and 390 deletions

View file

@ -25,6 +25,7 @@
#include "persistent_memory.h"
#include "algo/cryptonight/cryptonight.h"
#include "options.h"
static size_t offset = 0;
@ -41,7 +42,9 @@ void * persistent_calloc(size_t num, size_t size) {
void * create_persistent_ctx(int thr_id) {
struct cryptonight_ctx *ctx = (struct cryptonight_ctx *) &persistent_memory[MEMORY - sizeof(struct cryptonight_ctx) * (thr_id + 1)];
ctx->memory = &persistent_memory[MEMORY * (thr_id + 1)];
const int ratio = opt_double_hash ? 2 : 1;
ctx->memory = &persistent_memory[MEMORY * (thr_id * ratio + 1)];
return ctx;
}