Consumes values on demand from a non-owning span. More...
#include <sw/device/silicon_creator/lib/bootstrap_fuzzer_util.h>
Public Member Functions | |
StreamParser (absl::Span< const uint8_t > data, bool verbose) | |
For speed, the constructor does not make a copy of data . More... | |
StreamParser (StreamParser &&)=default | |
StreamParser (StreamParser &)=delete | |
spi_device_cmd_t | ParseCmdOr (spi_device_cmd_t default_value) |
Attempts to parse a spi_device_cmd_t . More... | |
template<typename IntType > | |
IntType | ParseIntOr (const char *log_label, IntType default_value) |
Attempts to parse an IntType from the stream. More... | |
Consumes values on demand from a non-owning span.
Definition at line 24 of file bootstrap_fuzzer_util.h.
|
inline |
For speed, the constructor does not make a copy of data
.
Ensure that data
points to memory that outlives this
.
data | Non-owning view into fuzzer-generated data. |
verbose | Whether verbose logging is enabled. |
Definition at line 33 of file bootstrap_fuzzer_util.h.
|
inline |
Attempts to parse a spi_device_cmd_t
.
If there are not enough bytes, it returns default_value
. When verbose_
is true, it describes the returned value in a human-readable string written to stdout
Definition at line 45 of file bootstrap_fuzzer_util.h.
|
inline |
Attempts to parse an IntType
from the stream.
If there are not enough bytes, it returns default_value
. When verbose_
is true, it uses log_label
to write a human-readable message to stdout.
Definition at line 62 of file bootstrap_fuzzer_util.h.