BitVecTryEditDistance
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 |
Usage example (from documentation)
u64 distance;
bool ok = BitVecTryEditDistance(&bv1, &bv2, &distance);Success
Returns true and writes the minimum number of single-bit edits to *out. Neither operand is modified.
Failure
Returns false on allocator OOM while allocating the Wagner-Fischer scratch buffer. *out is left untouched.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
BitVec.c:1484:
}
bool BitVecTryEditDistance(BitVec *bv1, BitVec *bv2, u64 *out) {
ValidateBitVec(bv1);
ValidateBitVec(bv2);- In
BitVec.c:1554:
u64 BitVecEditDistanceWithError(BitVec *bv1, BitVec *bv2, bool *error) {
u64 result = 0;
bool ok = BitVecTryEditDistance(bv1, bv2, &result);
if (error) {
Last updated on