Cleanups
This commit is contained in:
parent
a3361e778b
commit
6afef0dd6d
|
@ -67,8 +67,7 @@ StepRow::StepRow(const StepRow& a) :
|
||||||
hash {new unsigned char[a.len]},
|
hash {new unsigned char[a.len]},
|
||||||
len {a.len}
|
len {a.len}
|
||||||
{
|
{
|
||||||
for (int i = 0; i < len; i++)
|
std::copy(a.hash, a.hash+a.len, hash);
|
||||||
hash[i] = a.hash[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FullStepRow::FullStepRow(unsigned int n, const eh_HashState& base_state, eh_index i) :
|
FullStepRow::FullStepRow(unsigned int n, const eh_HashState& base_state, eh_index i) :
|
||||||
|
@ -81,8 +80,7 @@ FullStepRow::FullStepRow(unsigned int n, const eh_HashState& base_state, eh_inde
|
||||||
FullStepRow& FullStepRow::operator=(const FullStepRow& a)
|
FullStepRow& FullStepRow::operator=(const FullStepRow& a)
|
||||||
{
|
{
|
||||||
unsigned char* p = new unsigned char[a.len];
|
unsigned char* p = new unsigned char[a.len];
|
||||||
for (int i = 0; i < a.len; i++)
|
std::copy(a.hash, a.hash+a.len, p);
|
||||||
p[i] = a.hash[i];
|
|
||||||
delete[] hash;
|
delete[] hash;
|
||||||
hash = p;
|
hash = p;
|
||||||
len = a.len;
|
len = a.len;
|
||||||
|
@ -111,8 +109,7 @@ FullStepRow& FullStepRow::operator^=(const FullStepRow& a)
|
||||||
void FullStepRow::TrimHash(int l)
|
void FullStepRow::TrimHash(int l)
|
||||||
{
|
{
|
||||||
unsigned char* p = new unsigned char[len-l];
|
unsigned char* p = new unsigned char[len-l];
|
||||||
for (int i = 0; i < len-l; i++)
|
std::copy(hash+l, hash+len, p);
|
||||||
p[i] = hash[i+l];
|
|
||||||
delete[] hash;
|
delete[] hash;
|
||||||
hash = p;
|
hash = p;
|
||||||
len -= l;
|
len -= l;
|
||||||
|
@ -164,7 +161,7 @@ Equihash::Equihash(unsigned int n, unsigned int k) :
|
||||||
std::set<std::vector<eh_index>> Equihash::BasicSolve(const eh_HashState& base_state)
|
std::set<std::vector<eh_index>> Equihash::BasicSolve(const eh_HashState& base_state)
|
||||||
{
|
{
|
||||||
assert(CollisionBitLength() + 1 < 8*sizeof(eh_index));
|
assert(CollisionBitLength() + 1 < 8*sizeof(eh_index));
|
||||||
eh_index init_size { ((eh_index) 1) << (CollisionBitLength() + 1) };
|
eh_index init_size { 1 << (CollisionBitLength() + 1) };
|
||||||
|
|
||||||
// 1) Generate first list
|
// 1) Generate first list
|
||||||
LogPrint("pow", "Generating first list\n");
|
LogPrint("pow", "Generating first list\n");
|
||||||
|
|
Loading…
Reference in New Issue