Skip to content
BitVecByteSize

BitVecByteSize

Description

Size in bytes of the backing storage allocated for bv.

Usage example (Cross-references)

Usage examples (Cross-references)
        bool result =
            (BitVecLen(&bitvec) == 0 && BitVecCapacity(&bitvec) == 0 && BitVecData(&bitvec) == NULL &&
             BitVecByteSize(&bitvec) == 0);
    
        // Clean up
        result      = result && (BitVecCapacity(&bv) == 0);
        result      = result && (BitVecData(&bv) == NULL);
        result      = result && (BitVecByteSize(&bv) == 0);
    
        // Clean up
        result = result && (BitVecCapacity(&bv) == 0);
        result = result && (BitVecData(&bv) == NULL);
        result = result && (BitVecByteSize(&bv) == 0);
    
        DefaultAllocatorDeinit(&alloc);
        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