github.com/metacubex/mihomo@v1.18.5/transport/tuic/congestion_v2/minmax_go120.go (about)

     1  //go:build !go1.21
     2  
     3  package congestion
     4  
     5  import "golang.org/x/exp/constraints"
     6  
     7  func Max[T constraints.Ordered](a, b T) T {
     8  	if a < b {
     9  		return b
    10  	}
    11  	return a
    12  }
    13  
    14  func Min[T constraints.Ordered](a, b T) T {
    15  	if a < b {
    16  		return a
    17  	}
    18  	return b
    19  }