Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMultipleOf64 ¶
IsMultipleOf64 returns whether v is a multiple of 64.
func LeastSignificantBitMask ¶
LeastSignificantBitMask returns a bit mask to return the least significant bits for a value starting from the bit index passed in. ie: if you want a mask for the 4 least significant bits, you call LeastSignificantBitMask(4)
Types ¶
type BitRun ¶
BitRun represents a run of bits with the same value of length Len with Set representing if the group of bits were 1 or 0.
type BitRunReader ¶
type BitRunReader interface {
NextRun() BitRun
}
BitRunReader is an interface that is usable by multiple callers to provide multiple types of bit run readers such as a reverse reader and so on.
It's a convenience interface for counting contiguous set/unset bits in a bitmap. In places where BitBlockCounter can be used, then it would be preferred to use that as it would be faster than using BitRunReader.
func NewBitRunReader ¶
func NewBitRunReader(bitmap []byte, offset int64, length int64) BitRunReader
NewBitRunReader returns a reader for the given bitmap, offset and length that grabs runs of the same value bit at a time for easy iteration.
type SetBitRun ¶
SetBitRun describes a run of contiguous set bits in a bitmap with Pos being the starting position of the run and Length being the number of bits.
type SetBitRunReader ¶
type SetBitRunReader interface { // NextRun will return the next run of contiguous set bits in the bitmap NextRun() SetBitRun // Reset allows re-using the reader by providing a new bitmap, offset and length. The arguments // match the New function for the reader being used. Reset([]byte, int64, int64) // VisitSetBitRuns calls visitFn for each set in a loop starting from the current position // it's roughly equivalent to simply looping, calling NextRun and calling visitFn on the run // for each run. VisitSetBitRuns(visitFn VisitFn) error }
SetBitRunReader is an interface for reading groups of contiguous set bits from a bitmap. The interface allows us to create different reader implementations that share the same interface easily such as a reverse set reader.
func NewReverseSetBitRunReader ¶
func NewReverseSetBitRunReader(validBits []byte, startOffset, numValues int64) SetBitRunReader
NewReverseSetBitRunReader returns a SetBitRunReader like NewSetBitRunReader, except it will return runs starting from the end of the bitmap until it reaches startOffset rather than starting at startOffset and reading from there. The SetBitRuns will still operate the same, so Pos will still be the position of the "left-most" bit of the run or the "start" of the run. It just returns runs starting from the end instead of starting from the beginning.
func NewSetBitRunReader ¶
func NewSetBitRunReader(validBits []byte, startOffset, numValues int64) SetBitRunReader
NewSetBitRunReader returns a SetBitRunReader for the bitmap starting at startOffset which will read numvalues bits.