Esempio n. 1
0
TEST(StringCompare, MemoryEqual_Performance) {
  const char* volatile s1 = g_s1;
  const char* volatile s2 = g_s2;
  int total = 0;
  for (int i = 0; i < 1000000; ++i) {
    total += MemoryEqual(s1, s2, sizeof(g_s1) - 1);
  }
  volatile int n = total;
  (void) n;
}
Esempio n. 2
0
// Does "this" end with "x"
bool StringPiece::ends_with(const StringPiece& x) const {
    return ((m_length >= x.m_length) &&
            (MemoryEqual(m_ptr + m_length - x.m_length, x.m_ptr, x.m_length)));
}
Esempio n. 3
0
// Does "this" start with "x"
bool StringPiece::starts_with(const StringPiece& x) const {
    return ((m_length >= x.m_length) && MemoryEqual(m_ptr, x.m_ptr, x.m_length));
}
Esempio n. 4
0
bool operator==(const StringPiece& x, const StringPiece& y)
{
    return ((x.size() == y.size()) && MemoryEqual(x.data(), y.data(), x.size()));
}
Esempio n. 5
0
bool DataBuffer::operator ==(const DataBuffer & other) const
{
    if (m_data_size_ != other.m_data_size_) return false;

    return MemoryEqual(m_buffer_, other.m_buffer_, m_data_size_);
}