Skip to content

Commit

Permalink
Optimize code in phase1.hpp (Chia-Network#208)
Browse files Browse the repository at this point in the history
Util::IntTo16Bytes(to_write, entry);
	memcpy(&(right_writer_buf[i * entry_size_bytes]), to_write, 16);
instead of:
	Util::IntTo16Bytes(&right_writer_buf[i * entry_size_bytes], entry);
Delete memcpy
  • Loading branch information
683280 authored May 24, 2021
1 parent 632c9d7 commit 809a5c1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/phase1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,11 @@ void* F1thread(int const index, uint8_t const k, const uint8_t* id, std::mutex*
// to increase CPU efficency.
f1.CalculateBuckets(x, loopcount, f1_entries.get());
for (uint32_t i = 0; i < loopcount; i++) {
uint8_t to_write[16];
uint128_t entry;

entry = (uint128_t)f1_entries[i] << (128 - kExtraBits - k);
entry |= (uint128_t)x << (128 - kExtraBits - 2 * k);
Util::IntTo16Bytes(to_write, entry);
memcpy(&(right_writer_buf[i * entry_size_bytes]), to_write, 16);
Util::IntTo16Bytes(&right_writer_buf[i * entry_size_bytes], entry);
right_writer_count++;
x++;
}
Expand Down

0 comments on commit 809a5c1

Please sign in to comment.