chore: use cmp in go 1.21

Co-authored-by: H1JK <hell0jack@protonmail.com>
This commit is contained in:
Larvan2
2023-09-15 23:15:05 +08:00
committed by Larvan2
parent c3d72f6883
commit fa49fd7ba2
5 changed files with 34 additions and 20 deletions

View File

@ -0,0 +1,19 @@
//go:build !go1.21
package congestion
import "golang.org/x/exp/constraints"
func Max[T constraints.Ordered](a, b T) T {
if a < b {
return b
}
return a
}
func Min[T constraints.Ordered](a, b T) T {
if a < b {
return a
}
return b
}