github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/util/math/math.go (about)

     1  package math
     2  
     3  // Max returns the maximum of two ints
     4  func Max(a, b int) int {
     5  	if a > b {
     6  		return a
     7  	}
     8  	return b
     9  }
    10  
    11  // Min returns the minimum of two ints
    12  func Min(a, b int) int {
    13  	if a < b {
    14  		return a
    15  	}
    16  	return b
    17  }
    18  
    19  // Max64 returns the maximum of two int64s
    20  func Max64(a, b int64) int64 {
    21  	if a > b {
    22  		return a
    23  	}
    24  	return b
    25  }
    26  
    27  // Min64 returns the minimum of two int64s
    28  func Min64(a, b int64) int64 {
    29  	if a < b {
    30  		return a
    31  	}
    32  	return b
    33  }
    34  
    35  // MinUint32 return the min of a and b.
    36  func MinUint32(a, b uint32) uint32 {
    37  	if a < b {
    38  		return a
    39  	}
    40  	return b
    41  }