32#ifndef ZYCORE_BITSET_H
33#define ZYCORE_BITSET_H
struct ZyanAllocator_ ZyanAllocator
Defines the ZyanAllocator struct.
ZYCORE_EXPORT ZyanStatus ZyanBitsetReset(ZyanBitset *bitset, ZyanUSize index)
Sets the bit at index of the given ZyanBitset instance to 0.
ZYCORE_EXPORT ZyanStatus ZyanBitsetGetSizeBytes(const ZyanBitset *bitset, ZyanUSize *size)
Returns the current size of the bitset in bytes.
ZYCORE_EXPORT ZyanStatus ZyanBitsetAND(ZyanBitset *destination, const ZyanBitset *source)
Performs a logical AND operation on the given ZyanBitset instances.
ZYCORE_EXPORT ZyanStatus ZyanBitsetReserve(ZyanBitset *bitset, ZyanUSize count)
Changes the capacity of the given ZyanBitset instance.
ZYCORE_EXPORT ZyanStatus ZyanBitsetAny(const ZyanBitset *bitset)
Checks, if at least one bit of the given bitset is set.
ZYCORE_EXPORT ZyanStatus ZyanBitsetInitEx(ZyanBitset *bitset, ZyanUSize count, ZyanAllocator *allocator, ZyanU8 growth_factor, ZyanU8 shrink_threshold)
Initializes the given ZyanBitset instance and sets a custom allocator and memory allocation/deallocat...
ZYCORE_EXPORT ZyanStatus ZyanBitsetTestLSB(ZyanBitset *bitset)
Returns the value of the least significant bit.
ZYCORE_EXPORT ZyanStatus ZyanBitsetPerformByteOperation(ZyanBitset *destination, const ZyanBitset *source, ZyanBitsetByteOperation operation)
Performs a byte-wise operation for every byte in the given ZyanBitset instances.
ZyanStatus(* ZyanBitsetByteOperation)(ZyanU8 *v1, const ZyanU8 *v2)
Defines the ZyanBitsetByteOperation function prototype.
Definition Bitset.h:77
ZYCORE_EXPORT ZyanStatus ZyanBitsetXOR(ZyanBitset *destination, const ZyanBitset *source)
Performs a logical XOR operation on the given ZyanBitset instances.
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanBitsetInit(ZyanBitset *bitset, ZyanUSize count)
Initializes the given ZyanBitset instance.
ZYCORE_EXPORT ZyanStatus ZyanBitsetClear(ZyanBitset *bitset)
Deletes all bits of the given ZyanBitset instance.
struct ZyanBitset_ ZyanBitset
Defines the ZyanVector struct.
ZYCORE_EXPORT ZyanStatus ZyanBitsetGetSize(const ZyanBitset *bitset, ZyanUSize *size)
Returns the current size of the bitset in bits.
ZYCORE_EXPORT ZyanStatus ZyanBitsetTest(ZyanBitset *bitset, ZyanUSize index)
Returns the value of the bit at index.
ZYCORE_EXPORT ZyanStatus ZyanBitsetToggle(ZyanBitset *bitset, ZyanUSize index)
Toggles the bit at index of the given ZyanBitset instance.
ZYCORE_EXPORT ZyanStatus ZyanBitsetOR(ZyanBitset *destination, const ZyanBitset *source)
Performs a logical OR operation on the given ZyanBitset instances.
ZYCORE_EXPORT ZyanStatus ZyanBitsetCount(const ZyanBitset *bitset, ZyanUSize *count)
Returns the amount of bits set in the given bitset.
ZYCORE_EXPORT ZyanStatus ZyanBitsetResetAll(ZyanBitset *bitset)
Sets all bits of the given ZyanBitset instance to 0.
ZYCORE_EXPORT ZyanStatus ZyanBitsetTestMSB(ZyanBitset *bitset)
Returns the value of the most significant bit.
ZYCORE_EXPORT ZyanStatus ZyanBitsetAll(const ZyanBitset *bitset)
Checks, if all bits of the given bitset are set.
ZYCORE_EXPORT ZyanStatus ZyanBitsetPush(ZyanBitset *bitset, ZyanBool value)
Adds a new bit at the end of the bitset.
ZYCORE_EXPORT ZyanStatus ZyanBitsetSetAll(ZyanBitset *bitset)
Sets all bits of the given ZyanBitset instance to 1.
ZYCORE_EXPORT ZyanStatus ZyanBitsetDestroy(ZyanBitset *bitset)
Destroys the given ZyanBitset instance.
ZYCORE_EXPORT ZyanStatus ZyanBitsetAssign(ZyanBitset *bitset, ZyanUSize index, ZyanBool value)
Sets the bit at index of the given ZyanBitset instance to the specified value.
ZYCORE_EXPORT ZyanStatus ZyanBitsetNone(const ZyanBitset *bitset)
Checks, if none bits of the given bitset are set.
ZYCORE_EXPORT ZyanStatus ZyanBitsetGetCapacity(const ZyanBitset *bitset, ZyanUSize *capacity)
Returns the current capacity of the bitset in bits.
ZYCORE_EXPORT ZyanStatus ZyanBitsetShrinkToFit(ZyanBitset *bitset)
Shrinks the capacity of the given bitset to match it's size.
ZYCORE_EXPORT ZyanStatus ZyanBitsetInitBuffer(ZyanBitset *bitset, ZyanUSize count, void *buffer, ZyanUSize capacity)
Initializes the given ZyanBitset instance and configures it to use a custom user defined buffer with ...
ZYCORE_EXPORT ZyanStatus ZyanBitsetPop(ZyanBitset *bitset)
Removes the last bit of the bitset.
ZYCORE_EXPORT ZyanStatus ZyanBitsetGetCapacityBytes(const ZyanBitset *bitset, ZyanUSize *capacity)
Returns the current capacity of the bitset in bytes.
ZYCORE_EXPORT ZyanStatus ZyanBitsetSet(ZyanBitset *bitset, ZyanUSize index)
Sets the bit at index of the given ZyanBitset instance to 1.
ZYCORE_EXPORT ZyanStatus ZyanBitsetFlip(ZyanBitset *bitset)
Flips all bits of the given ZyanBitset instance.
#define ZYAN_REQUIRES_LIBC
Marks functions that require libc (cannot be used with ZYAN_NO_LIBC).
Definition Defines.h:468
#define ZYCORE_EXPORT
Symbol is exported in shared library builds.
Definition Defines.h:330
Status code definitions and check macros.
ZyanU32 ZyanStatus
Defines the ZyanStatus data type.
Definition Status.h:48
Includes and defines some default data types.
ZyanU8 ZyanBool
Defines the ZyanBool data-type.
Definition Types.h:296
size_t ZyanUSize
Definition Types.h:224
uint8_t ZyanU8
Definition Types.h:216
Implements the vector container class.
struct ZyanVector_ ZyanVector
Defines the ZyanVector struct.
Defines the ZyanVector struct.
Definition Bitset.h:55
ZyanUSize size
The bitset size.
Definition Bitset.h:59
ZyanVector bits
The bitset data.
Definition Bitset.h:63