github.com/thanos-io/thanos@v0.32.5/internal/cortex/util/math/math.go (about) 1 // Copyright (c) The Cortex Authors. 2 // Licensed under the Apache License 2.0. 3 4 package math 5 6 // Max returns the maximum of two ints 7 func Max(a, b int) int { 8 if a > b { 9 return a 10 } 11 return b 12 } 13 14 // Min returns the minimum of two ints 15 func Min(a, b int) int { 16 if a < b { 17 return a 18 } 19 return b 20 } 21 22 // Max64 returns the maximum of two int64s 23 func Max64(a, b int64) int64 { 24 if a > b { 25 return a 26 } 27 return b 28 } 29 30 // Min64 returns the minimum of two int64s 31 func Min64(a, b int64) int64 { 32 if a < b { 33 return a 34 } 35 return b 36 }