MCPcopy Create free account
hub / github.com/couchbase/fleece / match_bitapScore

Method match_bitapScore

Fleece/Support/diff_match_patch.hh:1761–1769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1759 */
1760 private:
1761 double match_bitapScore(ssize_t e, ssize_t x, ssize_t loc, const string_t &pattern) const {
1762 const float accuracy = static_cast<float> (e) / pattern.length();
1763 const ssize_t proximity = (loc - x < 0)? (x - loc) : (loc - x);
1764 if (Match_Distance == 0) {
1765 // Dodge divide by zero error.
1766 return proximity == 0 ? accuracy : 1.0;
1767 }
1768 return accuracy + (proximity / static_cast<float> (Match_Distance));
1769 }
1770
1771 /**
1772 * Initialise the alphabet for the Bitap algorithm.

Callers

nothing calls this directly

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected