aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz/Fuzz.h
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/Fuzz.h')
-rw-r--r--fuzz/Fuzz.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/fuzz/Fuzz.h b/fuzz/Fuzz.h
index b27e04d341..bfee1b3b4c 100644
--- a/fuzz/Fuzz.h
+++ b/fuzz/Fuzz.h
@@ -27,10 +27,18 @@ public:
// Returns the total number of "random" bytes available.
size_t size() { return fBytes->size(); }
// Returns if there are no bytes remaining for fuzzing.
- bool exhausted(){
+ bool exhausted() {
return fBytes->size() == fNextByte;
}
+ size_t remaining() {
+ return fBytes->size() - fNextByte;
+ }
+
+ void deplete() {
+ fNextByte = fBytes->size();
+ }
+
// next() loads fuzzed bytes into the variable passed in by pointer.
// We use this approach instead of T next() because different compilers
// evaluate function parameters in different orders. If fuzz->next()
@@ -124,8 +132,7 @@ inline void Fuzz::nextRange(T* n, Min min, Max max) {
template <typename T, typename Min, typename Max>
inline void Fuzz::nextEnum(T* value, Min rmin, Max rmax) {
- using U = skstd::underlying_type_t<T>;
- this->nextRange((U*)value, (U)rmin, (U)rmax);
+ this->nextRange((uint32_t*)value, (uint32_t)rmin, (uint32_t)rmax);
}
template <typename T>