mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
util: improve streams.h:FindByte() performance
Avoid use of the expensive mod operator (%) when calculating the buffer offset. No functional difference. Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
This commit is contained in:
@@ -4565,7 +4565,7 @@ void Chainstate::LoadExternalBlockFile(
|
||||
try {
|
||||
// locate a header
|
||||
unsigned char buf[CMessageHeader::MESSAGE_START_SIZE];
|
||||
blkdat.FindByte(params.MessageStart()[0]);
|
||||
blkdat.FindByte(std::byte(params.MessageStart()[0]));
|
||||
nRewind = blkdat.GetPos() + 1;
|
||||
blkdat >> buf;
|
||||
if (memcmp(buf, params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE)) {
|
||||
|
||||
Reference in New Issue
Block a user