mirror of
https://github.com/Karaka-Management/cOMS.git
synced 2026-02-15 09:58:40 +00:00
make use of meow hash in the hash table
This commit is contained in:
parent
382ef60919
commit
b9a65135ff
|
|
@ -15,6 +15,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "../Hash/MeowHash.h"
|
||||||
|
|
||||||
namespace Stdlib
|
namespace Stdlib
|
||||||
{
|
{
|
||||||
namespace HashTable
|
namespace HashTable
|
||||||
|
|
@ -42,13 +44,12 @@ namespace Stdlib
|
||||||
inline
|
inline
|
||||||
unsigned long long hash_key(const char *key)
|
unsigned long long hash_key(const char *key)
|
||||||
{
|
{
|
||||||
unsigned long long hash = 14695981039346656037UL;
|
return (unsigned long long) MeowU64From(
|
||||||
for (const char *p = key; *p; ++p) {
|
Hash::Meow::MeowHash(Hash::Meow::MeowDefaultSeed,
|
||||||
hash ^= (unsigned long long)(unsigned char)(*p);
|
strlen(key),
|
||||||
hash *= 1099511628211UL;
|
(void *) key),
|
||||||
}
|
0
|
||||||
|
);
|
||||||
return hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ht *create_table(int max = 0, bool is_fixed = false)
|
ht *create_table(int max = 0, bool is_fixed = false)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user