Removed CnAlgo dependency from Algorithm class.

This commit is contained in:
XMRig 2020-04-03 00:25:41 +07:00
parent 914b7023a2
commit f19b2f7248
No known key found for this signature in database
GPG key ID: 446A53638BE94409
2 changed files with 18 additions and 23 deletions

View file

@ -25,7 +25,6 @@
#include "base/crypto/Algorithm.h" #include "base/crypto/Algorithm.h"
#include "base/crypto/CnAlgo.h"
#include "rapidjson/document.h" #include "rapidjson/document.h"
@ -169,15 +168,26 @@ size_t xmrig::Algorithm::l2() const
size_t xmrig::Algorithm::l3() const size_t xmrig::Algorithm::l3() const
{ {
# if defined(XMRIG_ALGO_RANDOMX) || defined(XMRIG_ALGO_ARGON2) || defined(XMRIG_ALGO_ASTROBWT)
constexpr size_t oneMiB = 0x100000; constexpr size_t oneMiB = 0x100000;
# endif
const Family f = family(); const auto f = family();
assert(f != UNKNOWN); assert(f != UNKNOWN);
if (f < RANDOM_X) { switch (f) {
return CnAlgo<>::memory(m_id); case CN:
return oneMiB * 2;
case CN_LITE:
return oneMiB;
case CN_HEAVY:
return oneMiB * 4;
case CN_PICO:
return oneMiB / 4;
default:
break;
} }
# ifdef XMRIG_ALGO_RANDOMX # ifdef XMRIG_ALGO_RANDOMX

View file

@ -53,24 +53,9 @@ public:
inline static size_t memory(Algorithm::Id algo) inline static size_t memory(Algorithm::Id algo)
{ {
switch (Algorithm::family(algo)) { Algorithm algorithm(algo);
case Algorithm::CN:
return CN_MEMORY;
case Algorithm::CN_LITE: return algorithm.isCN() ? algorithm.l3() : 0;
return CN_MEMORY / 2;
case Algorithm::CN_HEAVY:
return CN_MEMORY * 2;
case Algorithm::CN_PICO:
return CN_MEMORY / 8;
default:
break;
}
return 0;
} }
inline static uint32_t iterations(Algorithm::Id algo) inline static uint32_t iterations(Algorithm::Id algo)