diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-01 01:27:19 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-01 01:27:19 -0600 |
commit | f0206e819032643299552998253b2fdf55c1b6bd (patch) | |
tree | 91f9f93e5945a19f9b8570b4f211e8aca404b4d7 | |
parent | 9599d94470e0e82ae812edc83be8ae9c670e92a8 (diff) |
wow
-rw-r--r-- | pkg/btrfs/util.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/btrfs/util.go b/pkg/btrfs/util.go index 04462f8..312ec75 100644 --- a/pkg/btrfs/util.go +++ b/pkg/btrfs/util.go @@ -1,5 +1,9 @@ package btrfs +import ( + "golang.org/x/exp/constraints" +) + func inSlice[T comparable](needle T, haystack []T) bool { for _, straw := range haystack { if needle == straw { @@ -8,3 +12,10 @@ func inSlice[T comparable](needle T, haystack []T) bool { } return false } + +func max[T constraints.Ordered](a, b T) T { + if a > b { + return a + } + return b +} |