int.go 241 B

12345678910111213141516171819
  1. package mathx
  2. // MaxInt returns the larger one of a and b.
  3. func MaxInt(a, b int) int {
  4. if a > b {
  5. return a
  6. }
  7. return b
  8. }
  9. // MinInt returns the smaller one of a and b.
  10. func MinInt(a, b int) int {
  11. if a < b {
  12. return a
  13. }
  14. return b
  15. }