gmath/limits.go
2022-08-21 20:08:34 +02:00

20 lines
227 B
Go

package gmath
func Min[N Number](a, b N) N {
if a < b {
return a
}
return b
}
func Max[N Number](a, b N) N {
if a > b {
return a
}
return b
}
func Clamp[N Number](v, min, max N) N {
return Min(Max(v, min), max)
}