diff options
| author | Paul Eggert | 2017-02-19 12:22:33 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-02-19 12:23:19 -0800 |
| commit | c8d14cfc6c2d19077d137c7e917fbb4f104de222 (patch) | |
| tree | f04b71e2985c9399af5de2093600855899b009de /src | |
| parent | 5c1ebfc504bc0649a9e1105b1d9265c461739254 (diff) | |
| download | emacs-c8d14cfc6c2d19077d137c7e917fbb4f104de222.tar.gz emacs-c8d14cfc6c2d19077d137c7e917fbb4f104de222.zip | |
Fix glitches in recent hash table changes
* src/fns.c (Fmake_hash_table): Simplify the machine code slightly
by using 0 rather than -1.
* src/lisp.h (struct Lisp_Hash_Table.pure): Now bool rather
than a bitfield, for speed (the bitfield did not save space).
(struct Lisp_Hash_Table.rehash_threshold): Now double rather than
float, since the float caused unwanted rounding errors, e.g.,
(hash-table-rehash-threshold (make-hash-table)) yielded
0.800000011920929 instead of the correct 0.8.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 5 | ||||
| -rw-r--r-- | src/lisp.h | 10 |
2 files changed, 7 insertions, 8 deletions
| @@ -4445,9 +4445,8 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) | |||
| 4445 | 4445 | ||
| 4446 | /* Look for `:rehash-threshold THRESHOLD'. */ | 4446 | /* Look for `:rehash-threshold THRESHOLD'. */ |
| 4447 | i = get_key_arg (QCrehash_threshold, nargs, args, used); | 4447 | i = get_key_arg (QCrehash_threshold, nargs, args, used); |
| 4448 | rehash_threshold = | 4448 | rehash_threshold = (!i ? DEFAULT_REHASH_THRESHOLD |
| 4449 | i ? (FLOATP (args[i]) ? XFLOAT_DATA (args[i]) : -1.0) | 4449 | : FLOATP (args[i]) ? XFLOAT_DATA (args[i]) : 0); |
| 4450 | : DEFAULT_REHASH_THRESHOLD; | ||
| 4451 | if (! (0 < rehash_threshold && rehash_threshold <= 1)) | 4450 | if (! (0 < rehash_threshold && rehash_threshold <= 1)) |
| 4452 | signal_error ("Invalid hash table rehash threshold", args[i]); | 4451 | signal_error ("Invalid hash table rehash threshold", args[i]); |
| 4453 | 4452 | ||
diff --git a/src/lisp.h b/src/lisp.h index d8030728a5a..be42b3354e2 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1998,13 +1998,13 @@ struct Lisp_Hash_Table | |||
| 1998 | /* Number of key/value entries in the table. */ | 1998 | /* Number of key/value entries in the table. */ |
| 1999 | ptrdiff_t count; | 1999 | ptrdiff_t count; |
| 2000 | 2000 | ||
| 2001 | /* Non-nil if the table can be purecopied. The table cannot be | 2001 | /* True if the table can be purecopied. The table cannot be |
| 2002 | changed afterwards. */ | 2002 | changed afterwards. */ |
| 2003 | bool_bf pure : 1; | 2003 | bool pure; |
| 2004 | 2004 | ||
| 2005 | /* Resize hash table when number of entries/ table size is >= this | 2005 | /* Resize hash table when number of entries / table size is >= this |
| 2006 | ratio, a float. */ | 2006 | ratio. */ |
| 2007 | float rehash_threshold; | 2007 | double rehash_threshold; |
| 2008 | 2008 | ||
| 2009 | /* Vector of keys and values. The key of item I is found at index | 2009 | /* Vector of keys and values. The key of item I is found at index |
| 2010 | 2 * I, the value is found at index 2 * I + 1. | 2010 | 2 * I, the value is found at index 2 * I + 1. |