From cf72ed79c78f3ed7412c5826e907f3c177fc9b78 Mon Sep 17 00:00:00 2001 From: tevador Date: Sun, 28 Apr 2019 18:17:29 +0200 Subject: [PATCH] Function typedefs without pointer --- src/common.hpp | 12 ++++++------ src/dataset.hpp | 8 ++++---- src/jit_compiler_x86.hpp | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/common.hpp b/src/common.hpp index 3c483bf..ce6755a 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -113,11 +113,11 @@ namespace randomx { fpu_reg_t a[RegistersCount / 2]; }; - typedef void(*DatasetReadFunc)(addr_t, MemoryRegisters&, int_reg_t(®)[RegistersCount]); - typedef void(*ProgramFunc)(RegisterFile&, MemoryRegisters&, uint8_t* /* scratchpad */, uint64_t); - typedef void(*DatasetInitFunc)(randomx_cache* cache, uint8_t* dataset, uint32_t startBlock, uint32_t endBlock); + typedef void(DatasetReadFunc)(addr_t, MemoryRegisters&, int_reg_t(®)[RegistersCount]); + typedef void(ProgramFunc)(RegisterFile&, MemoryRegisters&, uint8_t* /* scratchpad */, uint64_t); + typedef void(DatasetInitFunc)(randomx_cache* cache, uint8_t* dataset, uint32_t startBlock, uint32_t endBlock); - typedef void(*DatasetDeallocFunc)(randomx_dataset*); - typedef void(*CacheDeallocFunc)(randomx_cache*); - typedef void(*CacheInitializeFunc)(randomx_cache*, const void*, size_t); + typedef void(DatasetDeallocFunc)(randomx_dataset*); + typedef void(CacheDeallocFunc)(randomx_cache*); + typedef void(CacheInitializeFunc)(randomx_cache*, const void*, size_t); } diff --git a/src/dataset.hpp b/src/dataset.hpp index 4458017..57c1650 100644 --- a/src/dataset.hpp +++ b/src/dataset.hpp @@ -29,7 +29,7 @@ along with RandomX. If not, see. /* Global scope for C binding */ struct randomx_dataset { uint8_t* memory = nullptr; - randomx::DatasetDeallocFunc dealloc; + randomx::DatasetDeallocFunc* dealloc; }; namespace randomx { @@ -39,10 +39,10 @@ namespace randomx { /* Global scope for C binding */ struct randomx_cache { uint8_t* memory = nullptr; - randomx::CacheDeallocFunc dealloc; + randomx::CacheDeallocFunc* dealloc; randomx::JitCompilerX86* jit; - randomx::CacheInitializeFunc initialize; - randomx::DatasetInitFunc datasetInit; + randomx::CacheInitializeFunc* initialize; + randomx::DatasetInitFunc* datasetInit; randomx::SuperscalarProgram programs[RANDOMX_CACHE_ACCESSES]; std::vector reciprocalCache; }; diff --git a/src/jit_compiler_x86.hpp b/src/jit_compiler_x86.hpp index 964dd93..64e7016 100644 --- a/src/jit_compiler_x86.hpp +++ b/src/jit_compiler_x86.hpp @@ -45,11 +45,11 @@ namespace randomx { template void generateSuperscalarHash(SuperscalarProgram (&programs)[N], std::vector &); void generateDatasetInitCode(); - ProgramFunc getProgramFunc() { - return (ProgramFunc)code; + ProgramFunc* getProgramFunc() { + return (ProgramFunc*)code; } - DatasetInitFunc getDatasetInitFunc() { - return (DatasetInitFunc)code; + DatasetInitFunc* getDatasetInitFunc() { + return (DatasetInitFunc*)code; } uint8_t* getCode() { return code;