summaryrefslogtreecommitdiff
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
commitbc146f3c56e1582275b884932d560c1e99dfcd25 (patch)
treef913703c7c613d69ec9d835115e6f2a57f0fe168
parent5fa1cbeedb79f5578a1ffe5a6e2af0872d491f20 (diff)
implement btree lookup
-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
+ }
+}