diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2025-01-17 10:28:16 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2025-01-17 10:02:07 +0000 |
| commit | 5d04aae8969f6c72318ce0a4cde4f027766b1a55 (patch) | |
| tree | 8f1b632847c431407090f0fe1335522ff2195a37 /prog/rotation.go | |
| parent | f9e07a6e597b68d3397864e6ee4550f9065c3518 (diff) | |
all: use min/max functions
They are shorter, more readable, and don't require temp vars.
Diffstat (limited to 'prog/rotation.go')
| -rw-r--r-- | prog/rotation.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/prog/rotation.go b/prog/rotation.go index 8ec9f1947..85513e8c8 100644 --- a/prog/rotation.go +++ b/prog/rotation.go @@ -110,17 +110,10 @@ func MakeRotator(target *Target, calls map[*Syscall]bool, rnd *rand.Rand) *Rotat // However, we assume that 200 syscalls is enough for a fuzzing session, // so we cap at that level to make fuzzing more targeted. r.goal = len(calls) * 19 / 20 - if r.goal < 1 { - r.goal = 1 - } - if max := 200; r.goal > max { - r.goal = max - } + r.goal = max(r.goal, 1) + r.goal = min(r.goal, 200) // How many syscalls that don't use any resources we want to add? - r.nresourceless = r.goal * len(r.resourceless) / len(calls) - if r.nresourceless < 1 { - r.nresourceless = 1 - } + r.nresourceless = max(1, r.goal*len(r.resourceless)/len(calls)) return r } |
