comparison src/fns.c @ 75218:6a5ce97ea40d

(maybe_resize_hash_table): Copy new size of hash table into EMACS_INT to avoid GCC warnings.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 13 Jan 2007 21:46:28 +0000
parents a2250a4829ad
children 3d45362f1d38
comparison
equal deleted inserted replaced
75217:9e5c071deb9f 75218:6a5ce97ea40d
4666 { 4666 {
4667 if (NILP (h->next_free)) 4667 if (NILP (h->next_free))
4668 { 4668 {
4669 int old_size = HASH_TABLE_SIZE (h); 4669 int old_size = HASH_TABLE_SIZE (h);
4670 int i, new_size, index_size; 4670 int i, new_size, index_size;
4671 EMACS_INT nsize;
4671 4672
4672 if (INTEGERP (h->rehash_size)) 4673 if (INTEGERP (h->rehash_size))
4673 new_size = old_size + XFASTINT (h->rehash_size); 4674 new_size = old_size + XFASTINT (h->rehash_size);
4674 else 4675 else
4675 new_size = old_size * XFLOATINT (h->rehash_size); 4676 new_size = old_size * XFLOATINT (h->rehash_size);
4676 new_size = max (old_size + 1, new_size); 4677 new_size = max (old_size + 1, new_size);
4677 index_size = next_almost_prime ((int) 4678 index_size = next_almost_prime ((int)
4678 (new_size 4679 (new_size
4679 / XFLOATINT (h->rehash_threshold))); 4680 / XFLOATINT (h->rehash_threshold)));
4680 if (max (index_size, 2 * new_size) > MOST_POSITIVE_FIXNUM) 4681 /* Assignment to EMACS_INT stops GCC whining about limited range
4682 of data type. */
4683 nsize = max (index_size, 2 * new_size);
4684 if (nsize > MOST_POSITIVE_FIXNUM)
4681 error ("Hash table too large to resize"); 4685 error ("Hash table too large to resize");
4682 4686
4683 h->key_and_value = larger_vector (h->key_and_value, 2 * new_size, Qnil); 4687 h->key_and_value = larger_vector (h->key_and_value, 2 * new_size, Qnil);
4684 h->next = larger_vector (h->next, new_size, Qnil); 4688 h->next = larger_vector (h->next, new_size, Qnil);
4685 h->hash = larger_vector (h->hash, new_size, Qnil); 4689 h->hash = larger_vector (h->hash, new_size, Qnil);