Documentation
¶
Index ¶
- type FileBitmap
- func And(a, b *FileBitmap, reuseBuffer bool) *FileBitmap
- func FromActiveRange(fromLine, toLine int) *FileBitmap
- func FromLineCount(lines int) *FileBitmap
- func NewFileBitmapFromBytes(data []byte) *FileBitmap
- func Not(a *FileBitmap, reuseBuffer bool) *FileBitmap
- func Or(a, b *FileBitmap, reuseBuffer bool) *FileBitmap
- func (fb *FileBitmap) BitCount() int
- func (fb *FileBitmap) CountActiveBits() int
- func (fb *FileBitmap) Get(line int) bool
- func (fb *FileBitmap) GetBuffer() []byte
- func (fb *FileBitmap) HasActiveBits() bool
- func (fb *FileBitmap) IntersectsWith(other *FileBitmap) bool
- func (fb *FileBitmap) Set(line int)
- func (fb *FileBitmap) Size() int
- func (fb *FileBitmap) String() string
- func (fb *FileBitmap) ToArray() []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileBitmap ¶
type FileBitmap struct {
// contains filtered or unexported fields
}
FileBitmap represents a memory-efficient, modifiable bitmap.
func And ¶
func And(a, b *FileBitmap, reuseBuffer bool) *FileBitmap
And performs a bitwise AND operation between two FileBitmaps. If reuseBuffer is true, the result is stored in bitmap 'a'; otherwise, a new FileBitmap is allocated.
func FromActiveRange ¶
func FromActiveRange(fromLine, toLine int) *FileBitmap
FromActiveRange creates a FileBitmap with enough space for 'toLine' lines, and sets all bits in the range [fromLine, toLine] (1-indexed).
func FromLineCount ¶
func FromLineCount(lines int) *FileBitmap
FromLineCount creates a new FileBitmap that can hold the specified number of lines (bits).
func NewFileBitmapFromBytes ¶
func NewFileBitmapFromBytes(data []byte) *FileBitmap
NewFileBitmapFromBytes creates a new FileBitmap from a given byte slice without modifying it.
func Not ¶
func Not(a *FileBitmap, reuseBuffer bool) *FileBitmap
Not performs a bitwise NOT operation on a FileBitmap. If reuseBuffer is true, the result is stored in the original bitmap; otherwise, a new FileBitmap is allocated.
func Or ¶
func Or(a, b *FileBitmap, reuseBuffer bool) *FileBitmap
Or performs a bitwise OR operation between two FileBitmaps. If reuseBuffer is true, the result is stored in bitmap 'a'; otherwise, a new FileBitmap is allocated.
func (*FileBitmap) BitCount ¶
func (fb *FileBitmap) BitCount() int
BitCount returns the total number of bits in the bitmap.
func (*FileBitmap) CountActiveBits ¶
func (fb *FileBitmap) CountActiveBits() int
CountActiveBits counts the number of bits set to 1 in the bitmap.
func (*FileBitmap) Get ¶
func (fb *FileBitmap) Get(line int) bool
Get returns true if the bit at the given line (1-indexed) is set to 1.
func (*FileBitmap) GetBuffer ¶
func (fb *FileBitmap) GetBuffer() []byte
GetBuffer returns the internal byte buffer of the bitmap.
func (*FileBitmap) HasActiveBits ¶
func (fb *FileBitmap) HasActiveBits() bool
HasActiveBits returns true if at least one bit is set in the bitmap.
func (*FileBitmap) IntersectsWith ¶
func (fb *FileBitmap) IntersectsWith(other *FileBitmap) bool
IntersectsWith returns true if this bitmap has at least one common set bit with the other bitmap.
func (*FileBitmap) Set ¶
func (fb *FileBitmap) Set(line int)
Set sets the bit at the given line (1-indexed) to 1.
func (*FileBitmap) Size ¶
func (fb *FileBitmap) Size() int
Size returns the size of the bitmap in bytes.
func (*FileBitmap) String ¶
func (fb *FileBitmap) String() string
String returns a string representation of the bitmap as a binary string.
func (*FileBitmap) ToArray ¶
func (fb *FileBitmap) ToArray() []byte
ToArray returns a new copy of the bitmap data.