cleanup code

This commit is contained in:
2025-05-01 18:04:42 +00:00
parent a446bbd923
commit 2351faf2d7
3 changed files with 13 additions and 27 deletions

View File

@@ -63,18 +63,14 @@ func SafeArgMax[T constraints.Integer](valids []bool, values []T) (bool, int) {
hasValid := false
maxIndex := 0
maxValue := math.MinInt
for i := 0; i < len(valids); i++ {
for i := range valids {
if valids[i] && int(values[i]) > maxValue {
hasValid = true
maxIndex = i
maxValue = int(values[i])
}
}
if hasValid {
return true, maxIndex
} else {
return false, 0
}
return hasValid, maxIndex
}
func SafeArgMin[T constraints.Integer](valids []bool, values []T) (bool, int) {