From bc146f3c56e1582275b884932d560c1e99dfcd25 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 1 Jul 2022 21:49:11 -0600 Subject: implement btree lookup --- pkg/util/generic.go | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 + } +} -- cgit v1.2.3-54-g00ecf