BitVecReplace
- Function
- August 22, 2025
Table of Contents
BitVecReplace
BitVecReplace
Description
Replace first occurrence 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)
bool replaced = BitVecReplace(&flags, &old_pat, &new_pat);
Usage example (Cross-references)
- In
BitVec.c:1479
:
}
bool BitVecReplace(BitVec *bv, BitVec *old_pattern, BitVec *new_pattern) {
ValidateBitVec(bv);
ValidateBitVec(old_pattern);
bool test_bitvec_replace_null_source(void) {
printf("Testing BitVecReplace(NULL, old, new) - should fatal\n");
// Don't create BitVecs since we're testing NULL source validation
// Don't create BitVecs since we're testing NULL source validation
BitVecReplace(NULL, (BitVec *)0x1, (BitVec *)0x1);
return true;
}
// BitVecReplace tests
bool test_bitvec_replace_basic(void) {
printf("Testing BitVecReplace basic functionality\n");
BitVec source = BitVecInit();
BitVecPush(&new_pattern, true);
bool replaced = BitVecReplace(&source, &old_pattern, &new_pattern);
result = result && replaced;
// BitVecReplace tests
bool test_bitvec_replace_basic(void) {
printf("Testing BitVecReplace basic functionality\n");
BitVec source = BitVecInit();
BitVecPush(&new_pattern, true);
bool replaced = BitVecReplace(&source, &old_pattern, &new_pattern);
result = result && replaced;
bool test_bitvec_replace_null_source(void) {
printf("Testing BitVecReplace(NULL, old, new) - should fatal\n");
// Don't create BitVecs since we're testing NULL source validation
// Don't create BitVecs since we're testing NULL source validation
BitVecReplace(NULL, (BitVec *)0x1, (BitVec *)0x1);
return true;
}