mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Replaced util Min/Max functions with builtin
This commit is contained in:
parent
357932f9b0
commit
bcc7bf3167
5 changed files with 4 additions and 34 deletions
|
@ -17,22 +17,6 @@ package util
|
|||
|
||||
import "golang.org/x/exp/constraints"
|
||||
|
||||
func Max[T constraints.Ordered](m, n T) T {
|
||||
if n > m {
|
||||
return n
|
||||
} else {
|
||||
return m
|
||||
}
|
||||
}
|
||||
|
||||
func Min[T constraints.Ordered](m, n T) T {
|
||||
if n < m {
|
||||
return n
|
||||
} else {
|
||||
return m
|
||||
}
|
||||
}
|
||||
|
||||
func Sum[T constraints.Integer | constraints.Float](v ...T) T {
|
||||
var sum T
|
||||
for _, i := range v {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue