github.com/jbendotnet/noms@v0.0.0-20190904222105-c43e4293ea92/go/util/math/minmax.go (about)

     1  // Copyright 2016 Attic Labs, Inc. All rights reserved.
     2  // Licensed under the Apache License, version 2.0:
     3  // http://www.apache.org/licenses/LICENSE-2.0
     4  
     5  package math
     6  
     7  // MaxInt returns the larger of x or y.
     8  func MaxInt(x, y int) int {
     9  	if x > y {
    10  		return x
    11  	}
    12  	return y
    13  }
    14  
    15  // MinInt returns the smaller of x or y.
    16  func MinInt(x, y int) int {
    17  	if x < y {
    18  		return x
    19  	}
    20  	return y
    21  }