RoaringBitmap Java version has an optimized version of this, but it's using bitcount internally which should make it slower in .NET Java version has an optimized version of this, but it's using bitcount internally which should make it slower in .NET Use List directly, because the enumerator is a struct Creates a new immutable RoaringBitmap from an existing list of integers List of integers RoaringBitmap Optimizes a RoaringBitmap to prepare e.g. for Serialization/Deserialization RoaringBitmap Creates a new immutable RoaringBitmap from an existing list of integers List of integers RoaringBitmap Bitwise Or operation of two RoaringBitmaps RoaringBitmap RoaringBitmap RoaringBitmap Bitwise And operation of two RoaringBitmaps RoaringBitmap RoaringBitmap RoaringBitmap Bitwise Not operation of a RoaringBitmap RoaringBitmap RoaringBitmap Bitwise Xor operation of two RoaringBitmaps RoaringBitmap RoaringBitmap RoaringBitmap Bitwise AndNot operation of two RoaringBitmaps RoaringBitmap RoaringBitmap RoaringBitmap Serializes a RoaringBitmap into a stream using the 'official' RoaringBitmap file format RoaringBitmap Stream Deserializes a RoaringBitmap from astream using the 'official' RoaringBitmap file format Stream Pretty much everything in here are straight conversions from the original Util class in the java Roaring Bitmap project. see https://en.wikipedia.org/wiki/Hamming_weight Unfortunately there is no popcnt in c# see https://en.wikipedia.org/wiki/Hamming_weight Unfortunately there is no popcnt in c# Find the smallest integer larger than pos such that array[pos]>= min. otherwise return length -> The first line is BinarySearch with pos + 1, the second line is the bitwise complement if the value can't be found