aboutsummaryrefslogtreecommitdiffstats
path: root/prog/hints.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/hints.go
parentf9e07a6e597b68d3397864e6ee4550f9065c3518 (diff)
all: use min/max functions
They are shorter, more readable, and don't require temp vars.
Diffstat (limited to 'prog/hints.go')
-rw-r--r--prog/hints.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/prog/hints.go b/prog/hints.go
index a02d2d123..90ebab179 100644
--- a/prog/hints.go
+++ b/prog/hints.go
@@ -208,10 +208,7 @@ replacerLoop:
func checkDataArg(arg *DataArg, compMap CompMap, exec func() bool) {
bytes := make([]byte, 8)
data := arg.Data()
- size := len(data)
- if size > maxDataLength {
- size = maxDataLength
- }
+ size := min(len(data), maxDataLength)
for i := 0; i < size; i++ {
original := make([]byte, 8)
copy(original, data[i:])
@@ -307,10 +304,7 @@ func shrinkExpand(v uint64, compMap CompMap, bitsize uint64, image bool) []uint6
mutant = v & ((1 << size) - 1)
} else {
width = -iwidth
- size = uint64(width) * 8
- if size > bitsize {
- size = bitsize
- }
+ size = min(uint64(width)*8, bitsize)
if v&(1<<(size-1)) == 0 {
continue
}