BitVecByteSize

Table of Contents

BitVecByteSize

Description

Get u64 of bitvector in bytes. This returns the actual memory used by the bit data.

Parameters

NameDirectionDescription
bvinBitvector to get byte u64 of

Usage example (from documentation)

  u64 bytes_used = BitVecByteSize(&flags);

Usage example (Cross-references)

    result = result && (BitVecCapacity(&bv) == 0);
    result = result && BitVecEmpty(&bv);
    result = result && (BitVecByteSize(&bv) == 0);
    
    // Add bits and test macros again
    result = result && (BitVecCapacity(&bv) >= 65);
    result = result && !BitVecEmpty(&bv);
    result = result && (BitVecByteSize(&bv) >= 9); // At least 9 bytes for 65 bits
    
    // Test with exactly power-of-2 sizes
    
    result = result && (BitVecLen(&bv) == 64);
    result = result && (BitVecByteSize(&bv) >= 8); // At least 8 bytes for 64 bits
    
    BitVecDeinit(&bv);

Share :

Related Posts

BitVecReserve

BitVecReserve Description Reserve space for at least n bits in bitvector. Does not change the length, only ensures capacity.

Read More

BitVecDeinit

BitVecDeinit Description Deinitialize bitvector and free all allocated memory. After calling this, the bitvector should not be used unless re-initialized.

Read More

BitVecLen

BitVecLen Description Get number of bits currently in bitvector.

Read More