MCPcopy Create free account
hub / github.com/chen3feng/toft / compare

Method compare

base/string/string_piece.cpp:56–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56int StringPiece::compare(const StringPiece& x) const {
57#if 0
58 return CompareByteString(m_ptr, m_length, x.m_ptr, x.m_length);
59#else // unoptimized code
60 int r = memcmp(m_ptr, x.m_ptr, m_length < x.m_length ? m_length : x.m_length);
61 if (r != 0)
62 return r;
63 if (m_length < x.m_length)
64 return -1;
65 else if (m_length > x.m_length)
66 return 1;
67 return 0;
68#endif
69}
70
71int StringPiece::ignore_case_compare(const StringPiece& x) const {
72 int r = memcasecmp(m_ptr, x.m_ptr, m_length < x.m_length ? m_length : x.m_length);

Callers 1

operator<Function · 0.80

Calls 1

CompareByteStringFunction · 0.85

Tested by

no test coverage detected