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

Method diff_commonPrefix

Fleece/Support/diff_match_patch.hh:708–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

706 */
707 public:
708 static ssize_t diff_commonPrefix(const string_t &text1, const string_t &text2) {
709 // Performance analysis: http://neil.fraser.name/news/2007/10/09/
710 const ssize_t n = std::min(text1.length(), text2.length());
711 for (ssize_t i = 0; i < n; i++) {
712 if (text1[i] != text2[i]) {
713 return i;
714 }
715 }
716 return n;
717 }
718
719 /**
720 * Determine the common suffix of two strings.

Callers

nothing calls this directly

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected