ZYCORE_EXPORTZyanStatusZyanBitsetAll(constZyanBitset*bitset)
Checks, if all bits of the given bitset are set.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
ZYAN_STATUS_TRUE, if all bits are set, ZYAN_STATUS_FALSE, if not. Another zyan status code, if an
error occurred.
ZYCORE_EXPORTZyanStatusZyanBitsetAND(ZyanBitset*destination,constZyanBitset*source)
Performs a logical AND operation on the given ZyanBitset instances.
Parametersdestination A pointer to the ZyanBitset instance that is used as the first input and as the
destination.
source A pointer to the ZyanBitset instance that is used as the second input.
Returns
A zyan status code.
If the destination bitmask contains more bits than the source one, the state of the remaining bits will
be undefined.
ZYCORE_EXPORTZyanStatusZyanBitsetAny(constZyanBitset*bitset)
Checks, if at least one bit of the given bitset is set.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
ZYAN_STATUS_TRUE, if at least one bit is set, ZYAN_STATUS_FALSE, if not. Another zyan status code, if
an error occurred.
ZYCORE_EXPORTZyanStatusZyanBitsetAssign(ZyanBitset*bitset,ZyanUSizeindex,ZyanBoolvalue)
Sets the bit at index of the given ZyanBitset instance to the specified value.
Parametersbitset A pointer to the ZyanBitset instance.
index The bit index.
value The new value.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetClear(ZyanBitset*bitset)
Deletes all bits of the given ZyanBitset instance.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetCount(constZyanBitset*bitset,ZyanUSize*count)
Returns the amount of bits set in the given bitset.
Parametersbitset A pointer to the ZyanBitset instance.
count Receives the amount of bits set in the given bitset.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetDestroy(ZyanBitset*bitset)
Destroys the given ZyanBitset instance.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetFlip(ZyanBitset*bitset)
Flips all bits of the given ZyanBitset instance.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetGetCapacity(constZyanBitset*bitset,ZyanUSize*capacity)
Returns the current capacity of the bitset in bits.
Parametersbitset A pointer to the ZyanBitset instance.
capacity Receives the size of the bitset in bits.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetGetCapacityBytes(constZyanBitset*bitset,ZyanUSize*capacity)
Returns the current capacity of the bitset in bytes.
Parametersbitset A pointer to the ZyanBitset instance.
capacity Receives the size of the bitset in bytes.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetGetSize(constZyanBitset*bitset,ZyanUSize*size)
Returns the current size of the bitset in bits.
Parametersbitset A pointer to the ZyanBitset instance.
size Receives the size of the bitset in bits.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetGetSizeBytes(constZyanBitset*bitset,ZyanUSize*size)
Returns the current size of the bitset in bytes.
Parametersbitset A pointer to the ZyanBitset instance.
size Receives the size of the bitset in bytes.
Returns
A zyan status code.
ZYCORE_EXPORTZYAN_REQUIRES_LIBCZyanStatusZyanBitsetInit(ZyanBitset*bitset,ZyanUSizecount)
Initializes the given ZyanBitset instance.
Parametersbitset A pointer to the ZyanBitset instance.
count The initial amount of bits.
Returns
A zyan status code.
The space for the bitset is dynamically allocated by the default allocator using the default growth
factor and the default shrink threshold.
ZYCORE_EXPORTZyanStatusZyanBitsetInitBuffer(ZyanBitset*bitset,ZyanUSizecount,void*buffer,ZyanUSizecapacity)
Initializes the given ZyanBitset instance and configures it to use a custom user defined buffer with a
fixed size.
Parametersbitset A pointer to the ZyanBitset instance.
count The initial amount of bits.
buffer A pointer to the buffer that is used as storage for the bits.
capacity The maximum capacity (number of bytes) of the buffer.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetInitEx(ZyanBitset*bitset,ZyanUSizecount,ZyanAllocator*allocator,ZyanU8growth_factor,ZyanU8shrink_threshold)
Initializes the given ZyanBitset instance and sets a custom allocator and memory allocation/deallocation
parameters.
Parametersbitset A pointer to the ZyanBitset instance.
count The initial amount of bits.
allocator A pointer to a ZyanAllocator instance.
growth_factor The growth factor.
shrink_threshold The shrink threshold.
Returns
A zyan status code.
A growth factor of 1 disables overallocation and a shrink threshold of 0 disables dynamic shrinking.
ZYCORE_EXPORTZyanStatusZyanBitsetNone(constZyanBitset*bitset)
Checks, if none bits of the given bitset are set.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
ZYAN_STATUS_TRUE, if none bits are set, ZYAN_STATUS_FALSE, if not. Another zyan status code, if an
error occurred.
ZYCORE_EXPORTZyanStatusZyanBitsetOR(ZyanBitset*destination,constZyanBitset*source)
Performs a logical OR operation on the given ZyanBitset instances.
Parametersdestination A pointer to the ZyanBitset instance that is used as the first input and as the
destination.
source A pointer to the ZyanBitset instance that is used as the second input.
Returns
A zyan status code.
If the destination bitmask contains more bits than the source one, the state of the remaining bits will
be undefined.
ZYCORE_EXPORTZyanStatusZyanBitsetPerformByteOperation(ZyanBitset*destination,constZyanBitset*source,ZyanBitsetByteOperationoperation)
Performs a byte-wise operation for every byte in the given ZyanBitset instances.
Parametersdestination A pointer to the ZyanBitset instance that is used as the first input and as the
destination.
source A pointer to the ZyanBitset instance that is used as the second input.
operation A pointer to the function that performs the desired operation.
Returns
A zyan status code.
The operation callback is invoked once for every byte in the smallest of the ZyanBitset instances.
ZYCORE_EXPORTZyanStatusZyanBitsetPop(ZyanBitset*bitset)
Removes the last bit of the bitset.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetPush(ZyanBitset*bitset,ZyanBoolvalue)
Adds a new bit at the end of the bitset.
Parametersbitset A pointer to the ZyanBitset instance.
value The value of the new bit.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetReserve(ZyanBitset*bitset,ZyanUSizecount)
Changes the capacity of the given ZyanBitset instance.
Parametersbitset A pointer to the ZyanBitset instance.
count The new capacity (number of bits).
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetReset(ZyanBitset*bitset,ZyanUSizeindex)
Sets the bit at index of the given ZyanBitset instance to 0.
Parametersbitset A pointer to the ZyanBitset instance.
index The bit index.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetResetAll(ZyanBitset*bitset)
Sets all bits of the given ZyanBitset instance to 0.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetSet(ZyanBitset*bitset,ZyanUSizeindex)
Sets the bit at index of the given ZyanBitset instance to 1.
Parametersbitset A pointer to the ZyanBitset instance.
index The bit index.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetSetAll(ZyanBitset*bitset)
Sets all bits of the given ZyanBitset instance to 1.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetShrinkToFit(ZyanBitset*bitset)
Shrinks the capacity of the given bitset to match it's size.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetTest(ZyanBitset*bitset,ZyanUSizeindex)
Returns the value of the bit at index.
Parametersbitset A pointer to the ZyanBitset instance.
index The bit index.
Returns
ZYAN_STATUS_TRUE, if the bit is set or ZYAN_STATUS_FALSE, if not, Another zyan status code, if an
error occurred.
ZYCORE_EXPORTZyanStatusZyanBitsetTestLSB(ZyanBitset*bitset)
Returns the value of the least significant bit.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
ZYAN_STATUS_TRUE, if the bit is set or ZYAN_STATUS_FALSE, if not. Another zyan status code, if an
error occurred.
ZYCORE_EXPORTZyanStatusZyanBitsetTestMSB(ZyanBitset*bitset)
Returns the value of the most significant bit.
Parametersbitset A pointer to the ZyanBitset instance.
Returns
ZYAN_STATUS_TRUE, if the bit is set or ZYAN_STATUS_FALSE, if not. Another zyan status code, if an
error occurred.
ZYCORE_EXPORTZyanStatusZyanBitsetToggle(ZyanBitset*bitset,ZyanUSizeindex)
Toggles the bit at index of the given ZyanBitset instance.
Parametersbitset A pointer to the ZyanBitset instance.
index The bit index.
Returns
A zyan status code.
ZYCORE_EXPORTZyanStatusZyanBitsetXOR(ZyanBitset*destination,constZyanBitset*source)
Performs a logical XOR operation on the given ZyanBitset instances.
Parametersdestination A pointer to the ZyanBitset instance that is used as the first input and as the
destination.
source A pointer to the ZyanBitset instance that is used as the second input.
Returns
A zyan status code.
If the destination bitmask contains more bits than the source one, the state of the remaining bits will
be undefined.