Merge Assembly enum and Asm class.

This commit is contained in:
XMRig 2019-06-28 13:08:08 +07:00
parent 188338c493
commit 66d62de681
19 changed files with 164 additions and 139 deletions

View file

@ -32,7 +32,7 @@
#include "base/kernel/interfaces/IJsonReader.h"
#include "common/cpu/Cpu.h"
#include "core/config/Config.h"
#include "crypto/cn/Asm.h"
#include "crypto/common/Assembly.h"
#include "rapidjson/document.h"
#include "rapidjson/filewritestream.h"
#include "rapidjson/prettywriter.h"
@ -45,7 +45,6 @@ static char affinity_tmp[20] = { 0 };
xmrig::Config::Config() :
m_aesMode(AES_AUTO),
m_algoVariant(AV_AUTO),
m_assembly(ASM_AUTO),
m_hugePages(true),
m_safe(false),
m_shouldSave(false),
@ -99,7 +98,7 @@ void xmrig::Config::getJSON(rapidjson::Document &doc) const
doc.AddMember("http", m_http.toJSON(doc), allocator);
# ifdef XMRIG_FEATURE_ASM
doc.AddMember("asm", Asm::toJSON(m_assembly), allocator);
doc.AddMember("asm", m_assembly.toJSON(), allocator);
# endif
doc.AddMember("autosave", isAutoSave(), allocator);
@ -285,6 +284,6 @@ xmrig::AlgoVariant xmrig::Config::getAlgoVariantLite() const
#ifdef XMRIG_FEATURE_ASM
void xmrig::Config::setAssembly(const rapidjson::Value &assembly)
{
m_assembly = Asm::parse(assembly);
m_assembly = assembly;
}
#endif

View file

@ -31,7 +31,6 @@
xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
m_assembly(ASM_NONE),
m_aes(false),
m_avx2(false),
m_L2_exclusive(false),
@ -78,10 +77,10 @@ xmrig::AdvancedCpuInfo::AdvancedCpuInfo() :
m_aes = true;
if (data.vendor == VENDOR_AMD) {
m_assembly = (data.ext_family >= 23) ? ASM_RYZEN : ASM_BULLDOZER;
m_assembly = (data.ext_family >= 23) ? Assembly::RYZEN : Assembly::BULLDOZER;
}
else if (data.vendor == VENDOR_INTEL) {
m_assembly = ASM_INTEL;
m_assembly = Assembly::INTEL;
}
}

View file

@ -40,7 +40,7 @@ public:
protected:
size_t optimalThreadsCount(size_t memSize, int maxCpuUsage) const override;
inline Assembly assembly() const override { return m_assembly; }
inline Assembly::Id assembly() const override { return m_assembly; }
inline bool hasAES() const override { return m_aes; }
inline bool hasAVX2() const override { return m_avx2; }
inline bool isSupported() const override { return true; }