diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-05-27 21:36:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-05-27 21:36:30 -0700 |
commit | faff9755a3c84eeb1b51a961777468b899a17a30 (patch) | |
tree | 4dba83f7ecc1bdc0fcbad1520f32400afa9a985a /syslog.h | |
parent | 5a4d281d6701e9f27b67bf9def3842780410ab56 (diff) | |
download | txr-faff9755a3c84eeb1b51a961777468b899a17a30.tar.gz txr-faff9755a3c84eeb1b51a961777468b899a17a30.tar.bz2 txr-faff9755a3c84eeb1b51a961777468b899a17a30.zip |
Store hash values in hash entries.
Here, we augment the cons cells used for the hash chain assoc
lists with one more field to store the hash value. This lets
us grow hash tables without recalculating the hashes, and to
perform hash searches with fewer equality comparisons.
* hash.c (struct hash): assoc_fun and acons_new_c_fun function
pointers get a new cnum hash argument.
(hash_equal_op): Pass cell's hash value to assoc_fun.
(hash_grow): No need to compute each hash entry's hash
code; just pull it out from the cell, and mod it with the
new modulus to get the chain index.
(hash_assoc, hash_assql, hash_acons_new_c,
hash_aconsql_new_c): New static functions.
(make_hash): Store hash_assoc, hash_assql, hash_acons_new_c
and hash_aconsql_new_c in place of assoc, assql,
acons_new_c and aconsql_new_c.
(gethash_c, gethash, gethash_f, gethash_n, remhash):
Pass hash alue to assoc_fun or acons_new_c_fun.
* lib.h (struct cons_hash_entry): New struct type.
(union obj): New member ch.
Diffstat (limited to 'syslog.h')
0 files changed, 0 insertions, 0 deletions