BitVecEditDistanceWithError
Description
Calculate edit distance between two bitvectors. Edit distance is minimum number of single-bit operations to transform one into the other.
Parameters
| Name | Direction | Description |
|---|---|---|
bv1 |
in | First bitvector |
bv2 |
in | Second bitvector |
error |
out | Optional pointer set to true on failure and false on success |
Usage example (from documentation)
u64 distance = BitVecEditDistance(&bv1, &bv2);Success
Returns the minimum number of single-bit edits to transform bv1 into bv2. When error is non-NULL, *error is set to false. Neither operand is modified.
Failure
Returns 0 on allocator OOM during the Wagner-Fischer scratch allocation. When error is non-NULL, *error is set to true; otherwise the caller cannot distinguish failure from a true zero distance.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Math.h:263:
static inline u64 bitvec_edit_distance_no_error(BitVec *bv1, BitVec *bv2) {
return BitVecEditDistanceWithError(bv1, bv2, NULL);
}- In
Math.h:295:
///
#define BitVecEditDistance(...) \
BITVEC_EDIT_DISTANCE_SELECT(__VA_ARGS__, BitVecEditDistanceWithError, bitvec_edit_distance_no_error)(__VA_ARGS__)
#endif // MISRA_STD_CONTAINER_BITVEC_MATH_H
- In
BitVec.c:1552:
}
u64 BitVecEditDistanceWithError(BitVec *bv1, BitVec *bv2, bool *error) {
u64 result = 0;
bool ok = BitVecTryEditDistance(bv1, bv2, &result);
Last updated on