Add memory to cryptonight_ctx.
This commit is contained in:
parent
f29d05bdde
commit
8ab4c1c8bd
13 changed files with 85 additions and 81 deletions
9
memory.c
9
memory.c
|
@ -24,6 +24,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "persistent_memory.h"
|
||||
#include "algo/cryptonight/cryptonight.h"
|
||||
|
||||
static size_t offset = 0;
|
||||
|
||||
|
@ -36,3 +37,11 @@ void * persistent_calloc(size_t num, size_t size) {
|
|||
|
||||
return mem;
|
||||
}
|
||||
|
||||
|
||||
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)];
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue