package
0.1.21
Repository: https://github.com/openacid/low.git
Documentation: pkg.go.dev

# README

bitmap - bitmap operation creation, query, rank/select impl

A bitmap is a []uint64.

BenchmarkFromStr32-4                  147230166                8.07 ns/op
BenchmarkStringToBytes-4              201391240                5.95 ns/op
BenchmarkNextOne/FoundInCurrentWord-4 334609323                3.56 ns/op
BenchmarkNextOne/EnumerateAllBits-4   294496100                4.03 ns/op
BenchmarkPrevOne/FoundInCurrentWord-4 334022793                3.59 ns/op
BenchmarkPrevOne/EnumerateAllBits-4   286702246                4.12 ns/op
BenchmarkRank64_5_bits-4              672754074                1.77 ns/op
BenchmarkRank128_5_bits-4             486679581                2.49 ns/op
BenchmarkRank64_64k_bits-4            881509602                1.35 ns/op
BenchmarkRank128_64k_bits-4           424685930                2.84 ns/op
BenchmarkSelect-4                     70999674                16.1 ns/op
BenchmarkSelect32-4                   141631495                8.54 ns/op
BenchmarkSelect32R64-4                153702387                7.85 ns/op
BenchmarkSelectU64Indexed-4           365140676                3.29 ns/op

# Functions

Fmt converts bitmap in an integer or in a slice of integer to binary format string, with significant bits at right.
FromStr32 returns a bit array from string and put them in the least significant "to-from" bits of a uint64.
Get returns a uint64 with the (i%64)-th bit set.
Get1 returns a uint64 with the least significant bit set if (i%64)-th bit is set.
Getw returns the i-th w-bit word in the least significant w bits of a uint64.
IndexRank128 creates a rank index for a bitmap.
IndexRank64 creates a rank index for a bitmap.
IndexSelect32 creates a index for operation "select" on a bitmap.
IndexSelect32R64 creates indexes for operation "select" on a bitmap.
Join creates a bitmap from a list of sub-bitmaps.
NewBuilder creates a new Builder with preallocated n bits.
NextOne find the next "1" in range `[i, end)`.
Of creates a bitmap of bits set to 1 at specified positions.
OfMany creates a bitmap from a list of sub-bitmap bit positions.
PrevOne find the previous "1" in range `[i, end)` If there is no "1" found, it returns -1.
Rank128 returns the count of 1 up to i excluding i and bit value at i, with the help of a 128-bit index.
Rank64 returns the count of 1 up to i excluding i and the bit value at i, with the help of a 64-bit index.
SafeGet is same as Get() except it return 0 instead of a panic when index out of boundary.
SafeGet1 is same as Get1() except it return 0 instead of a panic when index out of boundary.
Select32 returns the indexes of the i-th "1" and the (i+1)-th "1".
Select32R64 returns the indexes of the i-th "1" and the (i+1)-th "1".
Slice returns a new bitmap which is a "slice" of the input bitmap.
ToArray creates a new slice of int32 containing all of the integers stored in the bitmap in sorted order.

# Variables

Bit set i-th bit to 1.
Mask are pre-calculated width-indexed bit masks.
MaskUpto are mask with bits set upto i-th bit(include i-th bit).
RMask are pre-calculated reverse mask of Mask.
RMaskUpto are reverse of MaskUpto.

# Structs

Builder provides continous bitmap building.