Skip to main content

BitSet

BitSet is a set of bits that can be set, cleared and queried.

Methods


Set()

@classmethod
def Set(
i: uint
)

Sets the bit at the specified index. This method is used to mark a particular bit as 'on' within the BitSet.

Parameters

NameTypeDescription
iuintThe unsigned integer index of the bit to set.

Clear()

@classmethod
def Clear(
i: uint
)

Clears the bit at the specified index. This method is used to mark a particular bit as 'off' within the BitSet.

Parameters

NameTypeDescription
iuintThe unsigned integer index of the bit to clear.

IsSet()

@classmethod
def IsSet(
i: uint
) - > bool

Checks if the bit at the specified index is set. This method allows a caller to query the state of a specific bit.

Parameters

NameTypeDescription
iuintThe unsigned integer index of the bit to check.

Returns

TypeDescription
boolA boolean indicating whether the bit at the given index is set (true) or not (false).

BlockCount()

@classmethod
def BlockCount() - > int

Returns the number of blocks currently used by the BitSet. This indicates the internal storage size in terms of blocks.

Returns

TypeDescription
intThe integer count of blocks comprising the BitSet.

Cap()

@classmethod
def Cap() - > uint

Returns the maximum capacity of the BitSet in terms of bits. This indicates the total number of bits that can be stored without reallocation.

Returns

TypeDescription
uintThe unsigned integer representing the total bit capacity of the BitSet.

DeepCopyInto()

@classmethod
def DeepCopyInto(
out: *BitSet
)

Performs a deep copy of the current BitSet's contents into another provided BitSet instance. This is useful for efficiently copying the state without creating a new allocation.

Parameters

NameTypeDescription
out*BitSetA pointer to the destination BitSet instance where the current BitSet's contents will be copied.

DeepCopy()

@classmethod
def DeepCopy() - > [BitSet](bitset.md?sid=flytestdlib_bitarray_bitset)

Creates and returns a new BitSet that is a deep copy of the current instance. This allows for independent modification of the copied BitSet without affecting the original.

Returns

TypeDescription
[BitSet](bitset.md?sid=flytestdlib_bitarray_bitset)A new BitSet instance containing an exact copy of the original BitSet's data.