MCPcopy Create free account
hub / github.com/LuminanceHDR/LuminanceHDR / stringCompare

Function stringCompare

src/Libpfs/utils/string.cpp:39–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39static int stringCompare(const string &str1, const string &str2) {
40 int diff = 0;
41 size_t size = std::min(str1.size(), str2.size());
42 for (size_t idx = 0; idx < size && diff == 0; ++idx) {
43 diff = charDiff(str1[idx], str2[idx]);
44 }
45 if (diff != 0) return diff;
46
47 if (str2.length() == str1.length()) return 0;
48 if (str2.length() > str1.length()) return 1;
49 return -1;
50}
51
52bool StringUnsensitiveComp::operator()(const std::string &str1,
53 const std::string &str2) const {

Callers 1

operator()Method · 0.85

Calls 3

charDiffFunction · 0.85
minFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected