logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

include/Zycore/Bitset.h

Author

       Generated automatically by Doxygen for Zycore from the source code.

Zycore                                           Version 1.5.2.0                      include/Zycore/Bitset.h(3)

Detailed Description

       Implements the bitset class.

Function Documentation

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.

Name

       include/Zycore/Bitset.h

Synopsis

       #include <Zycore/Allocator.h>
       #include <Zycore/Status.h>
       #include <Zycore/Types.h>
       #include <Zycore/Vector.h>

   Classes
       struct ZyanBitset_Typedefs
       typedef struct ZyanBitset_ZyanBitset
       typedef ZyanStatus(* ZyanBitsetByteOperation) (ZyanU8 *v1, const ZyanU8 *v2)

   FunctionsZYCORE_EXPORTZYAN_REQUIRES_LIBCZyanStatusZyanBitsetInit (ZyanBitset *bitset, ZyanUSize count)
       ZYCORE_EXPORTZyanStatusZyanBitsetInitEx (ZyanBitset *bitset, ZyanUSize count, ZyanAllocator *allocator,
           ZyanU8 growth_factor, ZyanU8 shrink_threshold)
       ZYCORE_EXPORTZyanStatusZyanBitsetInitBuffer (ZyanBitset *bitset, ZyanUSize count, void *buffer,
           ZyanUSize capacity)
       ZYCORE_EXPORTZyanStatusZyanBitsetDestroy (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetPerformByteOperation (ZyanBitset *destination, const ZyanBitset
           *source, ZyanBitsetByteOperation operation)
       ZYCORE_EXPORTZyanStatusZyanBitsetAND (ZyanBitset *destination, const ZyanBitset *source)
       ZYCORE_EXPORTZyanStatusZyanBitsetOR (ZyanBitset *destination, const ZyanBitset *source)
       ZYCORE_EXPORTZyanStatusZyanBitsetXOR (ZyanBitset *destination, const ZyanBitset *source)
       ZYCORE_EXPORTZyanStatusZyanBitsetFlip (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetSet (ZyanBitset *bitset, ZyanUSize index)
       ZYCORE_EXPORTZyanStatusZyanBitsetReset (ZyanBitset *bitset, ZyanUSize index)
       ZYCORE_EXPORTZyanStatusZyanBitsetAssign (ZyanBitset *bitset, ZyanUSize index, ZyanBool value)
       ZYCORE_EXPORTZyanStatusZyanBitsetToggle (ZyanBitset *bitset, ZyanUSize index)
       ZYCORE_EXPORTZyanStatusZyanBitsetTest (ZyanBitset *bitset, ZyanUSize index)
       ZYCORE_EXPORTZyanStatusZyanBitsetTestMSB (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetTestLSB (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetSetAll (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetResetAll (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetPush (ZyanBitset *bitset, ZyanBool value)
       ZYCORE_EXPORTZyanStatusZyanBitsetPop (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetClear (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetReserve (ZyanBitset *bitset, ZyanUSize count)
       ZYCORE_EXPORTZyanStatusZyanBitsetShrinkToFit (ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetGetSize (const ZyanBitset *bitset, ZyanUSize *size)
       ZYCORE_EXPORTZyanStatusZyanBitsetGetCapacity (const ZyanBitset *bitset, ZyanUSize *capacity)
       ZYCORE_EXPORTZyanStatusZyanBitsetGetSizeBytes (const ZyanBitset *bitset, ZyanUSize *size)
       ZYCORE_EXPORTZyanStatusZyanBitsetGetCapacityBytes (const ZyanBitset *bitset, ZyanUSize *capacity)
       ZYCORE_EXPORTZyanStatusZyanBitsetCount (const ZyanBitset *bitset, ZyanUSize *count)
       ZYCORE_EXPORTZyanStatusZyanBitsetAll (const ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetAny (const ZyanBitset *bitset)
       ZYCORE_EXPORTZyanStatusZyanBitsetNone (const ZyanBitset *bitset)

Typedef Documentation

typedefstructZyanBitset_ZyanBitset
       Defines the ZyanVector struct.

       All fields in this struct should be considered as 'private'. Any changes may lead to unexpected behavior.

   typedefZyanStatus(*ZyanBitsetByteOperation)(ZyanU8*v1,constZyanU8*v2)
       Defines the ZyanBitsetByteOperation function prototype.

       Parametersv1 A pointer to the first byte. This value receives the result after performing the desired
           operation.
           v2 A pointer to the second byte.

       Returns
           A zyan status code.

       This function is used to perform byte-wise operations on two ZyanBitset instances.

See Also