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:
Larry Ruane
2020-08-10 15:23:03 -06:00
parent 604df63f6c
commit 72efc26439
5 changed files with 19 additions and 9 deletions

View File

@@ -53,7 +53,7 @@ FUZZ_TARGET(buffered_file)
return;
}
try {
opt_buffered_file->FindByte(fuzzed_data_provider.ConsumeIntegral<uint8_t>());
opt_buffered_file->FindByte(std::byte(fuzzed_data_provider.ConsumeIntegral<uint8_t>()));
} catch (const std::ios_base::failure&) {
}
},