summaryrefslogtreecommitdiff
path: root/pkg/util
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-07-01 21:49:11 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-07-01 21:49:11 -0600
commitf1bc48ee12c6873b6b57a2403325765e987ad813 (patch)
treefc5251156819daa9af85f4ca318b0f47012ee038 /pkg/util
parent22c72e497425dd24695f5ee8f883c977c7e38db6 (diff)
implement btree lookup
Diffstat (limited to 'pkg/util')
-rw-r--r--pkg/util/generic.go11
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
+ }
+}