Skip to content

Commit

Permalink
Expose RANDOMX_SCRATCHPAD_L3 as a function
Browse files Browse the repository at this point in the history
NIFs that link with librandomx can't rely on configuration.h
  • Loading branch information
JamesPiechota committed Dec 3, 2024
1 parent 0e5b2ac commit eef4dc8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/randomx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ extern "C" {
return DatasetItemCount;
}

unsigned long randomx_get_scratchpad_size() {
return randomx::ScratchpadSize;
}

void randomx_init_dataset(randomx_dataset *dataset, randomx_cache *cache, unsigned long startItem, unsigned long itemCount) {
assert(dataset != nullptr);
assert(cache != nullptr);
Expand Down
7 changes: 7 additions & 0 deletions src/randomx.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ RANDOMX_EXPORT void *randomx_get_dataset_memory(randomx_dataset *dataset);
*/
RANDOMX_EXPORT void randomx_release_dataset(randomx_dataset *dataset);

/**
* Gets size of the scratchpad in bytes.
*
* @return the size of the scratchpad in bytes.
*/
RANDOMX_EXPORT unsigned long randomx_get_scratchpad_size(void);

/**
* Creates and initializes a RandomX virtual machine.
*
Expand Down

0 comments on commit eef4dc8

Please sign in to comment.