1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

Kernel: Cache MAC<->IP mappings (from ARP responses) seen on the wire.

This commit is contained in:
Andreas Kling 2019-03-12 00:56:33 +01:00
parent 05c1a79454
commit 90f60d2f65
5 changed files with 67 additions and 14 deletions

View file

@ -155,20 +155,10 @@ slow_path:
void StringImpl::compute_hash() const
{
if (!length()) {
if (!length())
m_hash = 0;
} else {
unsigned hash = 0;
for (ssize_t i = 0; i < m_length; ++i) {
hash += m_characters[i];
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += hash << 3;
hash ^= hash >> 11;
hash += hash << 15;
m_hash = hash;
}
else
m_hash = string_hash(m_characters, m_length);
m_hasHash = true;
}