BitVecCapacity
- Macro
- August 22, 2025
Table of Contents
BitVecCapacity
BitVecCapacity
Description
Get capacity of bitvector in bits.
Parameters
Name | Direction | Description |
---|---|---|
bv | in | Bitvector to get capacity of |
Usage example (from documentation)
u64 max_bits = BitVecCapacity(&flags);
Usage example (Cross-references)
// Test BitVecLength and BitVecCapacity functions
bool test_bitvec_length_capacity(void) {
printf("Testing BitVecLength and BitVecCapacity\n");
BitVec bv = BitVecInit();
result = result && (BitVecLen(&bv) == 3);
result = result && (BitVecCapacity(&bv) >= 3);
// Reserve more space
BitVecReserve(&bv, 100);
result = result && (BitVecLen(&bv) == 3);
result = result && (BitVecCapacity(&bv) >= 100);
BitVecDeinit(&bv);
// Test length and capacity macros if they exist
result = result && (BitVecLen(&bv) == 2);
result = result && (BitVecCapacity(&bv) >= 2);
// Test some bit operations
// Initially should be empty
bool result = (BitVecLen(&bv) == 0) && (BitVecCapacity(&bv) == 0);
// Add some bits
result = result && (BitVecLen(&bv) == 3);
result = result && (BitVecCapacity(&bv) >= 3);
// Test empty check
// Test all macros on empty bitvector
result = result && (BitVecLen(&bv) == 0);
result = result && (BitVecCapacity(&bv) == 0);
result = result && BitVecEmpty(&bv);
result = result && (BitVecByteSize(&bv) == 0);
result = result && (BitVecLen(&bv) == 65);
result = result && (BitVecCapacity(&bv) >= 65);
result = result && !BitVecEmpty(&bv);
result = result && (BitVecByteSize(&bv) >= 9); // At least 9 bytes for 65 bits