diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-01 21:49:11 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-01 21:49:11 -0600 |
commit | f1bc48ee12c6873b6b57a2403325765e987ad813 (patch) | |
tree | fc5251156819daa9af85f4ca318b0f47012ee038 /pkg/util | |
parent | 22c72e497425dd24695f5ee8f883c977c7e38db6 (diff) |
implement btree lookup
Diffstat (limited to 'pkg/util')
-rw-r--r-- | pkg/util/generic.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/util/generic.go b/pkg/util/generic.go index 70fed5b..dbe077f 100644 --- a/pkg/util/generic.go +++ b/pkg/util/generic.go @@ -77,3 +77,14 @@ func SortedMapKeys[K constraints.Ordered, V any](m map[K]V) []K { SortSlice(ret) return ret } + +func CmpUint[T constraints.Unsigned](a, b T) int { + switch { + case a < b: + return -1 + case a == b: + return 0 + default: + return 1 + } +} |