summaryrefslogtreecommitdiff
path: root/hashtbl.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-02 17:40:00 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-02 17:40:00 -0700
commita59795c9860a9a31e6ccf3555ef0e0ca04a0dd87 (patch)
tree608679c4a8021e3e2e28644d1e3059a5e0091e4c /hashtbl.c
parent17394a7d8e3240c6dafddab7725d953904208e5a (diff)
downloadnasm-a59795c9860a9a31e6ccf3555ef0e0ca04a0dd87.tar.gz
Use the crc64 we already use as the perfect hash function prehash
Use the same crc64 that we already use for the symbol table hash as the perfect hash function prehash. We appear to get radically faster convergence this way, and the crc64 is probably *faster*, since the table likely to be resident in memory.
Diffstat (limited to 'hashtbl.c')
-rw-r--r--hashtbl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hashtbl.c b/hashtbl.c
index cefd37fe..cbe2a1b9 100644
--- a/hashtbl.c
+++ b/hashtbl.c
@@ -48,7 +48,7 @@ void **hash_find(struct hash_table *head, const char *key,
struct hash_insert *insert)
{
struct hash_tbl_node *np;
- uint64_t hash = crc64(key);
+ uint64_t hash = crc64(CRC64_INIT, key);
struct hash_tbl_node *tbl = head->table;
size_t mask = head->size-1;
size_t pos = hash & mask;
@@ -76,7 +76,7 @@ void **hash_findi(struct hash_table *head, const char *key,
struct hash_insert *insert)
{
struct hash_tbl_node *np;
- uint64_t hash = crc64i(key);
+ uint64_t hash = crc64i(CRC64_INIT, key);
struct hash_tbl_node *tbl = head->table;
size_t mask = head->size-1;
size_t pos = hash & mask;