go-zero/core/mathx/int.go

20 lines
241 B
Go
Raw Normal View History

2020-07-26 17:09:05 +08:00
package mathx
2021-02-21 20:47:01 +08:00
// MaxInt returns the larger one of a and b.
2020-07-26 17:09:05 +08:00
func MaxInt(a, b int) int {
if a > b {
return a
}
2021-02-09 13:50:21 +08:00
return b
2020-07-26 17:09:05 +08:00
}
2021-02-21 20:47:01 +08:00
// MinInt returns the smaller one of a and b.
2020-07-26 17:09:05 +08:00
func MinInt(a, b int) int {
if a < b {
return a
}
2021-02-09 13:50:21 +08:00
return b
2020-07-26 17:09:05 +08:00
}