Merge remote-tracking branch 'origin/topic/jazoff/fuzz-size-limit-speedup'

- Factored check into more descriptive function: ExceedsChunkLimit()

* origin/topic/jazoff/fuzz-size-limit-speedup:
  Speed up ChunkCount validity check
This commit is contained in:
Jon Siwek 2020-05-21 11:35:30 -07:00
commit 05f829c727
4 changed files with 18 additions and 5 deletions

View file

@ -47,9 +47,18 @@ public:
bool Valid(int chunk_count_limit = MAX_CHUNK_COUNT) const;
/**
* @param chunk_count_limit Number of chunks to stop counting at (zero
* means "never stop").
* @return the number of chunks in the fuzz buffer object
*/
int ChunkCount() const;
int ChunkCount(int chunk_count_limit = 0) const;
/**
* @param Maximum number of chunks to permit the FuzzBuffer to have.
* @return Whether the FuzzBuffer exceeds the desired chunk count limit.
*/
bool ExceedsChunkLimit(int chunk_count_limit) const
{ return ChunkCount(chunk_count_limit + 1) > chunk_count_limit; }
/**
* @return the next chunk to deliver, if one could be extracted