bool operator()(StrInternKey k1, StrInternKey k2) const { if (k1 < 0) { // AHM only gives lookup keys on the rhs of the equal operator assert(k1 >= kAhmMagicThreshold); return false; } assert(k2 >= 0 || k2 < kAhmMagicThreshold); auto const sd1 = to_sdata(k1); auto const s2 = to_sslice_punned(k2); return sd1->size() == s2->len && wordsame(sd1->data(), s2->ptr, s2->len); }
bool operator()(StrInternKey k1, StrInternKey k2) const { if (k1 < 0) { // AHM only gives lookup keys on the rhs of the equal operator assert(k1 >= kAhmMagicThreshold); return false; } assert(k2 >= 0 || k2 < kAhmMagicThreshold); auto const sd1 = to_sdata(k1); auto const len1 = sd1->size(); const char* const* ptr2; if (UNLIKELY(k2 < 0)) { auto slice2 = to_sslice(k2); if (len1 != slice2->len) return false; ptr2 = reinterpret_cast<const char* const*>(slice2); } else { auto string2 = to_sdata(k2); if (len1 != string2->size()) return false; ptr2 = reinterpret_cast<const char* const*>(string2); } return wordsame(sd1->data(), *ptr2, len1); }