/** * @file Hash.cpp * @author apio (cloudapio.eu) * @brief Common hash functions for use in hash tables. * * @copyright Copyright (c) 2023, the Luna authors. * */ #include #include u64 hash_memory(const void* mem, usize size, u64 salt) { const char* p = (const char*)mem; u64 h = salt; while (--size) h = h * 101 + (u64)*p++; return h; } template <> u64 hash(const char* const& value, u64 salt) { return hash_memory(value, strlen(value), salt); }