aboutsummaryrefslogtreecommitdiffstats
path: root/prog/prio.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-01-17 10:28:16 +0100
committerDmitry Vyukov <dvyukov@google.com>2025-01-17 10:02:07 +0000
commit5d04aae8969f6c72318ce0a4cde4f027766b1a55 (patch)
tree8f1b632847c431407090f0fe1335522ff2195a37 /prog/prio.go
parentf9e07a6e597b68d3397864e6ee4550f9065c3518 (diff)
all: use min/max functions
They are shorter, more readable, and don't require temp vars.
Diffstat (limited to 'prog/prio.go')
-rw-r--r--prog/prio.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/prog/prio.go b/prog/prio.go
index 142ad36b4..a18008271 100644
--- a/prog/prio.go
+++ b/prog/prio.go
@@ -7,6 +7,7 @@ import (
"fmt"
"math"
"math/rand"
+ "slices"
"sort"
)
@@ -61,12 +62,7 @@ func (target *Target) calcStaticPriorities() [][]int32 {
}
// The value assigned for self-priority (call wrt itself) have to be high, but not too high.
for c0, pp := range prios {
- var max int32
- for _, p := range pp {
- if p > max {
- max = p
- }
- }
+ max := slices.Max(pp)
if max == 0 {
pp[c0] = 1
} else {