2023-03-28 22:48:58 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2016-02-12 07:58:48 +00:00
|
|
|
package lib
|
|
|
|
|
2016-03-30 18:47:37 +00:00
|
|
|
func AbsInt(a int) int {
|
|
|
|
if a > 0 {
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
return a * -1
|
|
|
|
}
|
|
|
|
|
2016-02-12 07:58:48 +00:00
|
|
|
func MaxInt(a, b int) int {
|
|
|
|
if a > b {
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
return b
|
|
|
|
}
|
|
|
|
|
|
|
|
func MinInt(a, b int) int {
|
|
|
|
if a > b {
|
|
|
|
return b
|
|
|
|
}
|
|
|
|
return a
|
|
|
|
}
|
2020-04-23 23:16:04 +00:00
|
|
|
|
|
|
|
func MaxUint64(a, b uint64) uint64 {
|
|
|
|
if a > b {
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
return b
|
|
|
|
}
|