Skip to content
BitVecByteSize

BitVecByteSize

BitVecByteSize

Description

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

Parameters

Name Direction Description
bv in Bitvector to get byte u64 of

Usage example (from documentation)

  u64 bytes_used = BitVecByteSize(&flags);

Returns

Number of bytes used to store bits

Usage example (Cross-references)

Usage examples (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);
Last updated on