BitVecRemoveLast
BitVecRemoveLast
Description
Remove the last occurrence of a specific bit value. Returns true if a bit was found and removed, false otherwise.
Parameters
| Name | Direction | Description |
|---|---|---|
bv |
in | Bitvector to remove from |
value |
in | Bit value to find and remove (true or false) |
Usage example (from documentation)
bool found = BitVecRemoveLast(&flags, false);Returns
true if bit was found and removed, false if not found
Usage example (Cross-references)
Usage examples (Cross-references)
- In
BitVec.c:397:
}
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);
Last updated on