github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/base/minmax.go (about)

     1  package base
     2  
     3  // Min calculates the minimum between two unsigned integers (golang has no such function)
     4  func Min[T Value | int | float64 | uint32 | int64](x, y T) T {
     5  	if x < y {
     6  		return x
     7  	}
     8  	return y
     9  }
    10  
    11  // Max calculates the max between two unsigned integers (golang has no such function)
    12  func Max[T Value | int | float64 | uint32 | int64](x, y T) T {
    13  	if x > y {
    14  		return x
    15  	}
    16  	return y
    17  }