Skip to content

Commit

Permalink
Use memset instead of memcpy in get_block_longhash
Browse files Browse the repository at this point in the history
  • Loading branch information
who-biz committed Jun 26, 2020
1 parent 6a849da commit 59a2a71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cryptonote_basic/cryptonote_format_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ namespace cryptonote
{
blobdata bd = get_block_hashing_blob(b);
const int cn_variant = b.major_version >= 5 ? ( b.major_version >= 8 ? 2 : 1 ) : 0;
int cn_iters = b.major_version >= 6 ? (b.major_version >= 7 ? 0x40000 : 0x20000) : 0x80000;
uint32_t cn_iters = b.major_version >= 6 ? (b.major_version >= 7 ? 0x40000 : 0x20000) : 0x80000;
uint64_t its = 0;

if (b.major_version <= 7)
Expand Down Expand Up @@ -949,7 +949,7 @@ namespace cryptonote

// get 6 char from previous hash as varint
for (size_t i = 0; i < 3; i++) {
memcpy(&bytes_span[i], &b.prev_id.data[i], sizeof(b.prev_id.data[i]));
memset(&bytes_span[i], (int)(b.prev_id.data[i]), sizeof(b.prev_id.data[i]));
id_num |= bytes_span[i] << (24 - (8*(i+1)));
}

Expand Down

0 comments on commit 59a2a71

Please sign in to comment.