BitVecReplaceAll

Table of Contents

BitVecReplaceAll

Description

Replace all occurrences of old pattern with new pattern.

Parameters

NameDirectionDescription
bvinBitvector to modify
old_patterninPattern to find and replace
new_patterninPattern to replace with

Usage example (from documentation)

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

Usage example (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) {
    printf("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) {
    printf("Testing BitVecReplaceAll basic functionality\n");
    
    BitVec source      = BitVecInit();
    BitVecPush(&new_pattern, true);
    
    u64 replacements = BitVecReplaceAll(&source, &old_pattern, &new_pattern);
    result           = result && (replacements == 3);

Share :

Related Posts

BitVecContainsAt

BitVecContainsAt Description Check if bitvector contains the given pattern at a specific position.

Read More

BitVecStartsWith

BitVecStartsWith Description Check if bitvector starts with the given bit pattern.

Read More

BitVecReplace

BitVecReplace Description Replace first occurrence of old pattern with new pattern.

Read More