Removed code duplicate.

This commit is contained in:
XMRig 2020-05-09 01:13:46 +07:00
parent 85af4e27ec
commit 3cbf0dc0ee
No known key found for this signature in database
GPG key ID: 446A53638BE94409
16 changed files with 107 additions and 241 deletions

View file

@ -277,19 +277,7 @@ void xmrig::CpuBackend::prepare(const Job &nextJob)
# ifdef XMRIG_ALGO_ARGON2
const xmrig::Algorithm::Family f = nextJob.algorithm().family();
if ((f == Algorithm::ARGON2) || (f == Algorithm::RANDOM_X)) {
xmrig::String impl = d_ptr->controller->config()->cpu().argon2Impl();
if (impl.isEmpty()) {
if (xmrig::Cpu::info()->hasAVX2()) {
impl = "AVX2";
}
else if (xmrig::Cpu::info()->isX64()) {
impl = "SSE2";
}
}
if (argon2::Impl::select(impl)) {
if (argon2::Impl::select(d_ptr->controller->config()->cpu().argon2Impl())) {
LOG_INFO("%s use " WHITE_BOLD("argon2") " implementation " CSI "1;%dm" "%s",
tag,
argon2::Impl::name() == "default" ? 33 : 32,

View file

@ -59,7 +59,6 @@ namespace xmrig {
static const std::array<const char *, ICpuInfo::FLAG_MAX> flagNames = { "aes", "avx2", "avx512f", "bmi2", "osxsave", "pdpe1gb", "sse2", "ssse3", "xop" };
static const std::array<const char *, ICpuInfo::MSR_MOD_MAX> msrNames = { "none", "ryzen", "intel", "custom" };
std::bitset<ICpuInfo::FLAG_MAX> BasicCpuInfo::m_flags;
static inline void cpuid(uint32_t level, int32_t output[4])
@ -134,6 +133,21 @@ static inline bool has_xop() { return has_feature(0x80000001,
} // namespace xmrig
#ifdef XMRIG_ALGO_ARGON2
extern "C" {
int cpu_flags_has_avx2() { return xmrig::has_avx2(); }
int cpu_flags_has_avx512f() { return xmrig::has_avx512f(); }
int cpu_flags_has_sse2() { return xmrig::has_sse2(); }
int cpu_flags_has_ssse3() { return xmrig::has_ssse3(); }
int cpu_flags_has_xop() { return xmrig::has_xop(); }
}
#endif
xmrig::BasicCpuInfo::BasicCpuInfo() :
m_threads(std::thread::hardware_concurrency())
{

View file

@ -67,10 +67,9 @@ protected:
Vendor m_vendor = VENDOR_UNKNOWN;
private:
static std::bitset<FLAG_MAX> m_flags;
Assembly m_assembly = Assembly::NONE;
MsrMod m_msrMod = MSR_MOD_NONE;
std::bitset<FLAG_MAX> m_flags;
};

View file

@ -37,9 +37,6 @@
#include "3rdparty/rapidjson/document.h"
std::bitset<xmrig::ICpuInfo::FLAG_MAX> xmrig::BasicCpuInfo::m_flags;
xmrig::BasicCpuInfo::BasicCpuInfo() :
m_threads(std::thread::hardware_concurrency())
{