| 54 | } |
| 55 | |
| 56 | int 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 | |
| 71 | int 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); |
no test coverage detected