mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-27 15:02:12 -08:00
When coercing the hash threshold to double, set up a minimum to avoid underflows
This commit is contained in:
parent
5f5ab3a52c
commit
1f9bf63cae
1 changed files with 3 additions and 3 deletions
|
|
@ -509,6 +509,8 @@ do_clrhash(cl_object ht)
|
|||
}
|
||||
}
|
||||
|
||||
ecl_def_ct_single_float(min_threshold, 0.1, static, const);
|
||||
|
||||
cl_object
|
||||
cl__make_hash_table(cl_object test, cl_object size, cl_object rehash_size,
|
||||
cl_object rehash_threshold, cl_object lockable)
|
||||
|
|
@ -594,10 +596,8 @@ cl__make_hash_table(cl_object test, cl_object size, cl_object rehash_size,
|
|||
h->hash.entries = 0;
|
||||
h->hash.rehash_size = rehash_size;
|
||||
h->hash.threshold = rehash_threshold;
|
||||
rehash_threshold = cl_max(2, min_threshold, rehash_threshold);
|
||||
h->hash.factor = ecl_to_double(rehash_threshold);
|
||||
if (h->hash.factor < 0.1) {
|
||||
h->hash.factor = 0.1;
|
||||
}
|
||||
h->hash.limit = h->hash.size * h->hash.factor;
|
||||
h->hash.data = NULL; /* for GC sake */
|
||||
h->hash.data = (struct ecl_hashtable_entry *)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue