mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
mathx
This commit is contained in:
19
mathx/int.go
Normal file
19
mathx/int.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package mathx
|
||||||
|
|
||||||
|
// MaxInt returns the larger one of a and b.
|
||||||
|
func MaxInt(a, b int) int {
|
||||||
|
if a > b {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// MinInt returns the smaller one of a and b.
|
||||||
|
func MinInt(a, b int) int {
|
||||||
|
if a < b {
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
return b
|
||||||
|
}
|
Reference in New Issue
Block a user