Fixed global init/shutdown order

This commit is contained in:
SChernykh
2024-12-03 21:05:27 +01:00
parent ecdaa83669
commit fb8e2a71e0
15 changed files with 130 additions and 74 deletions

View File

@@ -116,17 +116,14 @@ NOINLINE void keccakf_plain(std::array<uint64_t, 25>& st)
}
}
void (*keccakf)(std::array<uint64_t, 25>&) = keccakf_plain;
keccakf_func keccakf = []() {
#if defined(__x86_64__) || defined(_M_AMD64)
static struct KeccakBMI_Check {
KeccakBMI_Check() {
if (randomx::Cpu().hasBmi()) {
keccakf = keccakf_bmi;
}
if (randomx::Cpu().hasBmi()) {
return keccakf_bmi;
}
} keccak_bmi_check;
#endif
return keccakf_plain;
}();
NOINLINE void keccak_step(const uint8_t* &in, int &inlen, std::array<uint64_t, 25>& st)
{