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);Success
Number of replacements made; bv reflects all rewrites.
Failure
Returns 0 when no match was found; aborts the walk and leaves bv in its pre-call state on allocator OOM.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
BitVec.c:1762:
}
u64 BitVecReplaceAll(BitVec *bv, BitVec *old_pattern, BitVec *new_pattern) {
ValidateBitVec(bv);
ValidateBitVec(old_pattern); DefaultAllocator alloc = DefaultAllocatorInit();
WriteFmt("Testing BitVecReplaceAll basic functionality\n");
BitVec source = BitVecInit(ALLOCATOR_OF(&alloc)); BitVecPush(&new_pattern, true);
u64 replacements = BitVecReplaceAll(&source, &old_pattern, &new_pattern);
result = result && (replacements == 3);
Last updated on