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

BitVecToBytes

BitVecToBytes Description Export bitvector to byte array. Copies the internal bit representation to the provided byte array.

Read More

BitVecCapacity

BitVecCapacity Description Get capacity of bitvector in bits.

Read More