Factorize the hash system.
Insert option to select the hash at dynamic time.
This commit is contained in:
1 parent
8d0d8cfc50
commit
a3811b52ee
3 files changed
+40
-6
No files matched your search
+2
-2
@@ -534,11 +534,11 @@ string_hash(const string_t v)
|
||||
{
|
||||
STRING_CONTRACT (v);
|
||||
const char *p = string_get_cstr(v);
|
||||
size_t hash = 0;
|
||||
M_HASH_DECL(hash);
|
||||
char c;
|
||||
do {
|
||||
c = *p++;
|
||||
hash = hash * 31421 + (unsigned int) c + 6297;
|
||||
M_HASH_UP(hash, M_ASSIGN_CAST(unsigned int,c));
|
||||
} while (c != 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user