BitVecRemoveLast

Table of Contents

BitVecRemoveLast

Description

Remove the last occurrence of a specific bit value. Returns true if a bit was found and removed, false otherwise.

Parameters

NameDirectionDescription
bvinBitvector to remove from
valueinBit value to find and remove (true or false)

Usage example (from documentation)

  bool found = BitVecRemoveLast(&flags, false);

Usage example (Cross-references)

    }
    
    bool BitVecRemoveLast(BitVec *bv, bool value) {
    ValidateBitVec(bv);
    // Test BitVecRemoveLast function
    bool test_bitvec_remove_last(void) {
    WriteFmt("Testing BitVecRemoveLast\n");
    
    BitVec bv = BitVecInit();
    
    // Remove last occurrence of false
    bool found = BitVecRemoveLast(&bv, false);
    
    // Check result: true, false, true, true (removed last false at index 3)
    
    // Remove last occurrence of true
    found = BitVecRemoveLast(&bv, true);
    
    // Check result: true, false, true (removed last true at index 3)
    result     = result && (found == false) && (bv.length == 0);
    
    found  = BitVecRemoveLast(&bv, false);
    result = result && (found == false) && (bv.length == 0);

Share :

Related Posts

BitVecEditDistance

BitVecEditDistance Description Calculate edit distance between two bitvectors. Edit distance is minimum number of single-bit operations to transform one into the other.

Read More

BitVecCorrelation

BitVecCorrelation Description Calculate Pearson correlation coefficient between two bitvectors. Treats bits as 0/1 values and computes linear correlation.

Read More

BitVecCosineSimilarity

BitVecCosineSimilarity Description Calculate cosine similarity between two bitvectors. Treats bitvectors as binary vectors and computes cosine of angle between them.

Read More