Basic cryptonight-ipbc definition.

This commit is contained in:
XMRig 2018-04-21 00:19:33 +07:00
parent 8fe264bbd7
commit 274992e50d
5 changed files with 39 additions and 7 deletions

View file

@ -4,6 +4,7 @@ project(xmrig)
option(WITH_LIBCPUID "Use Libcpuid" ON)
option(WITH_AEON "CryptoNight-Lite support" ON)
option(WITH_SUMO "CryptoNight-Heavy support" ON)
option(WITH_IPBC "CryptoNight-IPBC support" ON)
option(WITH_HTTPD "HTTP REST API" ON)
option(BUILD_STATIC "Build static binary" OFF)
@ -205,6 +206,10 @@ if (NOT WITH_SUMO)
add_definitions(/DXMRIG_NO_SUMO)
endif()
if (NOT WITH_IPBC)
add_definitions(/DXMRIG_NO_IPBC)
endif()
if (WITH_HTTPD)
find_package(MHD)

View file

@ -45,9 +45,14 @@ static const char *algoNames[] = {
nullptr,
# endif
# ifndef XMRIG_NO_SUMO
"cryptonight-heavy"
"cryptonight-heavy",
# else
nullptr
nullptr,
# endif
# ifndef XMRIG_NO_IPBC
"cryptonight-ipbc",
# else
nullptr,
# endif
};
@ -60,9 +65,14 @@ static const char *algoNamesShort[] = {
nullptr,
# endif
# ifndef XMRIG_NO_SUMO
"cn-heavy"
"cn-heavy",
# else
nullptr
nullptr,
# endif
# ifndef XMRIG_NO_IPBC
"cn-ipbc",
# else
nullptr,
# endif
};
@ -119,9 +129,9 @@ Pool::Pool(const char *host, uint16_t port, const char *user, const char *passwo
}
const char *Pool::algoName(xmrig::Algo algorithm)
const char *Pool::algoName(xmrig::Algo algorithm, bool shortName)
{
return algoNames[algorithm];
return (shortName ? algoNamesShort : algoNames)[algorithm];
}

View file

@ -51,7 +51,7 @@ public:
xmrig::Variant variant = xmrig::VARIANT_AUTO
);
static const char *algoName(xmrig::Algo algorithm);
static const char *algoName(xmrig::Algo algorithm, bool shortName = false);
static xmrig::Algo algorithm(const char *algo);
inline bool isNicehash() const { return m_nicehash; }

View file

@ -34,6 +34,7 @@ enum Algo {
CRYPTONIGHT, /* CryptoNight (Monero) */
CRYPTONIGHT_LITE, /* CryptoNight-Lite (AEON) */
CRYPTONIGHT_HEAVY, /* CryptoNight-Heavy (SUMO) */
CRYPTONIGHT_IPBC /* CryptoNight-IPBC (IPBC) */
};

View file

@ -47,11 +47,16 @@ constexpr const size_t CRYPTONIGHT_HEAVY_MEMORY = 4 * 1024 * 1024;
constexpr const uint32_t CRYPTONIGHT_HEAVY_MASK = 0x3FFFF0;
constexpr const uint32_t CRYPTONIGHT_HEAVY_ITER = 0x40000;
constexpr const size_t CRYPTONIGHT_IPBC_MEMORY = 1 * 1024 * 1024;
constexpr const uint32_t CRYPTONIGHT_IPBC_MASK = 0xFFFF0;
constexpr const uint32_t CRYPTONIGHT_IPBC_ITER = 0x40000;
template<Algo ALGO> inline constexpr size_t cn_select_memory() { return 0; }
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT>() { return CRYPTONIGHT_MEMORY; }
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT_LITE>() { return CRYPTONIGHT_LITE_MEMORY; }
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT_HEAVY>() { return CRYPTONIGHT_HEAVY_MEMORY; }
template<> inline constexpr size_t cn_select_memory<CRYPTONIGHT_IPBC>() { return CRYPTONIGHT_IPBC_MEMORY; }
inline size_t cn_select_memory(Algo algorithm)
{
@ -66,6 +71,9 @@ inline size_t cn_select_memory(Algo algorithm)
case CRYPTONIGHT_HEAVY:
return CRYPTONIGHT_HEAVY_MEMORY;
case CRYPTONIGHT_IPBC:
return CRYPTONIGHT_IPBC_MEMORY;
default:
break;
}
@ -78,6 +86,7 @@ template<Algo ALGO> inline constexpr uint32_t cn_select_mask() { retur
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT>() { return CRYPTONIGHT_MASK; }
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT_LITE>() { return CRYPTONIGHT_LITE_MASK; }
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT_HEAVY>() { return CRYPTONIGHT_HEAVY_MASK; }
template<> inline constexpr uint32_t cn_select_mask<CRYPTONIGHT_IPBC>() { return CRYPTONIGHT_IPBC_MASK; }
inline uint32_t cn_select_mask(Algo algorithm)
{
@ -92,6 +101,9 @@ inline uint32_t cn_select_mask(Algo algorithm)
case CRYPTONIGHT_HEAVY:
return CRYPTONIGHT_HEAVY_MASK;
case CRYPTONIGHT_IPBC:
return CRYPTONIGHT_IPBC_MASK;
default:
break;
}
@ -104,6 +116,7 @@ template<Algo ALGO> inline constexpr uint32_t cn_select_iter() { retur
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT>() { return CRYPTONIGHT_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE>() { return CRYPTONIGHT_LITE_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY>() { return CRYPTONIGHT_HEAVY_ITER; }
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_IPBC>() { return CRYPTONIGHT_IPBC_ITER; }
inline uint32_t cn_select_iter(Algo algorithm)
{
@ -118,6 +131,9 @@ inline uint32_t cn_select_iter(Algo algorithm)
case CRYPTONIGHT_HEAVY:
return CRYPTONIGHT_HEAVY_ITER;
case CRYPTONIGHT_IPBC:
return CRYPTONIGHT_IPBC_ITER;
default:
break;
}