Skip to content
BitVecReplaceAll

BitVecReplaceAll

BitVecReplaceAll

Description

Replace all occurrences of old pattern with new pattern.

Parameters

Name Direction Description
bv in Bitvector to modify
old_pattern in Pattern to find and replace
new_pattern in Pattern to replace with

Usage example (from documentation)

  u64 count = BitVecReplaceAll(&flags, &old_pat, &new_pat);

Returns

Number of replacements made

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    u64 BitVecReplaceAll(BitVec *bv, BitVec *old_pattern, BitVec *new_pattern) {
        ValidateBitVec(bv);
        ValidateBitVec(old_pattern);
    // BitVecReplaceAll tests
    bool test_bitvec_replace_all_basic(void) {
        WriteFmt("Testing BitVecReplaceAll basic functionality\n");
    
        BitVec source      = BitVecInit();
        BitVecPush(&new_pattern, true);
    
        u64 replacements = BitVecReplaceAll(&source, &old_pattern, &new_pattern);
        result           = result && (replacements == 3);
    // BitVecReplaceAll tests
    bool test_bitvec_replace_all_basic(void) {
        WriteFmt("Testing BitVecReplaceAll basic functionality\n");
    
        BitVec source      = BitVecInit();
        BitVecPush(&new_pattern, true);
    
        u64 replacements = BitVecReplaceAll(&source, &old_pattern, &new_pattern);
        result           = result && (replacements == 3);
Last updated on