mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-03 03:47:38 +03:00
19 lines
267 B
Go
19 lines
267 B
Go
//go:build go1.20 && !go1.21
|
|
|
|
package common
|
|
|
|
import "github.com/sagernet/sing/common/x/constraints"
|
|
|
|
func Min[T constraints.Ordered](x, y T) T {
|
|
if x < y {
|
|
return x
|
|
}
|
|
return y
|
|
}
|
|
|
|
func Max[T constraints.Ordered](x, y T) T {
|
|
if x < y {
|
|
return y
|
|
}
|
|
return x
|
|
}
|