From d98bf8776befe72c9f36a7977d1c720cb54bbc48 Mon Sep 17 00:00:00 2001 From: Paul Dreik Date: Sat, 28 Aug 2021 10:35:14 +0200 Subject: [PATCH] reorder cases to improve throughput mutating the first byte of the input now always results in picking on of the two paths. Before, two of the four possible outcomes resulted in doit() not being invoked. --- test/fuzzing/chrono-timepoint.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/fuzzing/chrono-timepoint.cc b/test/fuzzing/chrono-timepoint.cc index a9fd0a84..16aa7302 100644 --- a/test/fuzzing/chrono-timepoint.cc +++ b/test/fuzzing/chrono-timepoint.cc @@ -27,7 +27,7 @@ template void doit(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size < 1) return 0; - const auto action = data[0] & 0b11; + const auto action = data[0] & 0b1; data += 1; size -= 1; @@ -37,12 +37,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { doit(data, size); break; case 1: - // won't compile - // doit(data,size); + // may be the same as system_clock + doit(data, size); break; case 2: - // may be the same as system_clock - doit(data, size); + // won't compile + // doit(data,size); break; } } catch (...) {