Commit graph

3 commits

Author SHA1 Message Date
Leandro Pereira 368e74fdf8 AK: Allow seed value to be specified in string_hash()
For some algorithms, such as bloom filters, it's possible to reuse a
hash function (rather than having different hashing functions) if the
seed is different each time the hash function is used.

Modify AK::string_hash() to take a seed parameter, which defaults to 0
(the value the hash value was originally initialized to).
2021-10-25 23:37:18 +02:00
Ben Wiederhake f8d7b4daea AK: Add missing headers
Example failure:

IDAllocator.h only pulls in AK/Hashtable.h, so any compilation unit that
includes AK/IDAllocator.h without including AK/Traits.h before it used
to be doomed to fail with the cryptic error message "In instantiation of
'AK::HashTable<T, TraitsForT, IsOrdered>::Iterator AK::HashTable<T,
TraitsForT, IsOrdered>::find(const T&) [with T = int; TraitsForT =
AK::Traits: incomplete type 'AK::Traits<int>' used in nested name
specifier".
2021-10-06 23:52:40 +01:00
Andreas Kling 3e603b2f32 AK: Make StringView::hash() constexpr
This required moving string_hash() to its own header so that everyone
can see it.
2021-05-14 15:24:32 +02:00