/* An upper bound on the size of a hash table index. It must fit in
ptrdiff_t and be a valid Emacs fixnum. */
ptrdiff_t upper_bound = min (MOST_POSITIVE_FIXNUM,
- PTRDIFF_MAX / sizeof (ptrdiff_t));
+ min (TYPE_MAXIMUM (hash_idx_t),
+ PTRDIFF_MAX / sizeof (ptrdiff_t)));
ptrdiff_t index_size = size + (size >> 2); /* 1.25x larger */
if (index_size < upper_bound)
index_size = next_almost_prime (index_size);
/* The type of a hash table index, both for table indices and index
(hash) indices. It's signed and a subtype of ptrdiff_t. */
-typedef ptrdiff_t hash_idx_t;
+typedef int32_t hash_idx_t;
struct Lisp_Hash_Table
{