diff options
Diffstat (limited to 'src/util.go')
| -rw-r--r-- | src/util.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util.go b/src/util.go index de6f3654..5461705f 100644 --- a/src/util.go +++ b/src/util.go @@ -2,6 +2,7 @@ package fzf import "time" +// Max returns the largest integer func Max(first int, items ...int) int { max := first for _, item := range items { @@ -12,6 +13,7 @@ func Max(first int, items ...int) int { return max } +// Max32 returns the largest 32-bit integer func Max32(first int32, second int32) int32 { if first > second { return first @@ -19,6 +21,7 @@ func Max32(first int32, second int32) int32 { return second } +// Min returns the smallest integer func Min(first int, items ...int) int { min := first for _, item := range items { @@ -29,6 +32,7 @@ func Min(first int, items ...int) int { return min } +// DurWithin limits the given time.Duration with the upper and lower bounds func DurWithin( val time.Duration, min time.Duration, max time.Duration) time.Duration { if val < min { |
