X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=roaring.go;h=8e39416cd7446be4874ad0718f09ff96ee6b12df;hb=17930ef4600d0c7d538c495af7044f94a99801a7;hp=6e5409eca106073a85f9a392ebdc6e93db0db267;hpb=63b3d2d211ca13d7f7aaa17dc2595ba23c103970;p=btrtrc.git diff --git a/roaring.go b/roaring.go index 6e5409ec..8e39416c 100644 --- a/roaring.go +++ b/roaring.go @@ -1,13 +1,13 @@ package torrent import ( - "github.com/RoaringBitmap/roaring" + "github.com/anacrolix/torrent/typed-roaring" ) // Return the number of bits set in the range. To do this we need the rank of the item before the // first, and the rank of the last item. An off-by-one minefield. Hopefully I haven't missed // something in roaring's API that provides this. -func roaringBitmapRangeCardinality(bm *roaring.Bitmap, start, end uint32) (card uint64) { +func roaringBitmapRangeCardinality[T typedRoaring.BitConstraint](bm interface{ Rank(T) uint64 }, start, end T) (card uint64) { card = bm.Rank(end - 1) if start != 0 { card -= bm.Rank(start - 1)