1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
This commit is contained in:
2022-07-26 14:15:32 +08:00
parent 93352f03c1
commit ebd76d2df6

View File

@ -14,3 +14,10 @@ func Max[T constraints.Ordered](v1, v2 T) T {
func Min[T constraints.Ordered](v1, v2 T) T {
return expr.If(v1 < v2, v1, v2)
}
func abs(n int64) int64 {
y := n >> 63
return (n ^ y) - y
}