14 const auto hex_digits =
"0123456789ABCDEF";
18 while (
data.size() < length) {
19 auto digit = hex_digits[rng.
randbits(4)];
20 data.push_back(digit);
31 assert(result != std::nullopt);
uint64_t randbits(int bits) noexcept
Generate a random (bits)-bit integer.
Main entry point to nanobench's benchmarking facility.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Bench & batch(T b) noexcept
Sets the batch size.
Bench & unit(char const *unit)
Sets the operation unit.
void doNotOptimizeAway(Arg &&arg)
Makes sure none of the given arguments are optimized away by the compiler.
std::string generateHexString(size_t length)
static void HexParse(benchmark::Bench &bench)
BENCHMARK(HexParse, benchmark::PriorityLevel::HIGH)
std::optional< std::vector< Byte > > TryParseHex(std::string_view str)
Parse the hex string into bytes (uint8_t or std::byte).