Added "cn/xao" and "cn/rto".
This commit is contained in:
parent
a8de81a51b
commit
25bac30862
7 changed files with 112 additions and 48 deletions
|
@ -39,6 +39,7 @@ constexpr const size_t CRYPTONIGHT_MEMORY = 2 * 1024 * 1024;
|
|||
constexpr const uint32_t CRYPTONIGHT_MASK = 0x1FFFF0;
|
||||
constexpr const uint32_t CRYPTONIGHT_ITER = 0x80000;
|
||||
constexpr const uint32_t CRYPTONIGHT_MSR_ITER = 0x40000;
|
||||
constexpr const uint32_t CRYPTONIGHT_XAO_ITER = 0x100000;
|
||||
|
||||
constexpr const size_t CRYPTONIGHT_LITE_MEMORY = 1 * 1024 * 1024;
|
||||
constexpr const uint32_t CRYPTONIGHT_LITE_MASK = 0xFFFF0;
|
||||
|
@ -103,24 +104,37 @@ inline uint32_t cn_select_mask(Algo algorithm)
|
|||
}
|
||||
|
||||
|
||||
template<Algo ALGO, Variant variant> inline constexpr uint32_t cn_select_iter() { return 0; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_0>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_1>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_XTL>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_MSR>() { return CRYPTONIGHT_MSR_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_0>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_1>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_IPBC>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_0>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_XHV>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<Algo ALGO, Variant variant> inline constexpr uint32_t cn_select_iter() { return 0; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_0>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_1>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_XTL>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_MSR>() { return CRYPTONIGHT_MSR_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_XAO>() { return CRYPTONIGHT_XAO_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT, VARIANT_RTO>() { return CRYPTONIGHT_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_0>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_LITE, VARIANT_1>() { return CRYPTONIGHT_LITE_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_0>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_XHV>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
template<> inline constexpr uint32_t cn_select_iter<CRYPTONIGHT_HEAVY, VARIANT_TUBE>() { return CRYPTONIGHT_HEAVY_ITER; }
|
||||
|
||||
|
||||
inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
|
||||
{
|
||||
switch (variant) {
|
||||
case VARIANT_MSR:
|
||||
return CRYPTONIGHT_MSR_ITER;
|
||||
|
||||
case VARIANT_RTO:
|
||||
return CRYPTONIGHT_XAO_ITER;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(algorithm)
|
||||
{
|
||||
case CRYPTONIGHT:
|
||||
return variant == VARIANT_MSR ? CRYPTONIGHT_MSR_ITER : CRYPTONIGHT_ITER;
|
||||
return CRYPTONIGHT_ITER;
|
||||
|
||||
case CRYPTONIGHT_LITE:
|
||||
return CRYPTONIGHT_LITE_ITER;
|
||||
|
@ -139,15 +153,25 @@ inline uint32_t cn_select_iter(Algo algorithm, Variant variant)
|
|||
template<Variant variant> inline constexpr bool cn_is_monero() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_0>() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_1>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_IPBC>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_TUBE>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_XTL>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_MSR>() { return true; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_XHV>() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_XAO>() { return false; }
|
||||
template<> inline constexpr bool cn_is_monero<VARIANT_RTO>() { return true; }
|
||||
|
||||
|
||||
inline bool cn_is_monero(Variant variant)
|
||||
{
|
||||
return variant > VARIANT_0 && variant < VARIANT_XHV;
|
||||
switch (variant) {
|
||||
case VARIANT_0:
|
||||
case VARIANT_XHV:
|
||||
case VARIANT_RTO:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -462,7 +462,7 @@ inline void cryptonight_single_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
|
@ -576,7 +576,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l0[idx0 & MASK])[0] = al0;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l0[idx0 & MASK])[1] = ah0 ^ tweak1_2_0 ^ al0;
|
||||
}
|
||||
else {
|
||||
|
@ -615,7 +615,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
((uint64_t*)&l1[idx1 & MASK])[0] = al1;
|
||||
|
||||
if (IS_MONERO) {
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) {
|
||||
if (VARIANT == xmrig::VARIANT_RTO) {
|
||||
((uint64_t*)&l1[idx1 & MASK])[1] = ah1 ^ tweak1_2_1 ^ al1;
|
||||
}
|
||||
else {
|
||||
|
@ -690,7 +690,7 @@ inline void cryptonight_double_hash(const uint8_t *__restrict__ input, size_t si
|
|||
if (IS_MONERO) { \
|
||||
_mm_store_si128(ptr, _mm_xor_si128(a, mc)); \
|
||||
\
|
||||
if (VARIANT == xmrig::VARIANT_IPBC) { \
|
||||
if (VARIANT == xmrig::VARIANT_RTO) { \
|
||||
((uint64_t*)ptr)[1] ^= ((uint64_t*)ptr)[0]; \
|
||||
} \
|
||||
} else { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue