[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 68f8bc31114 15/20: Change hash_idx_t to int32_t on all platforms
From: |
Mattias Engdegård |
Subject: |
master 68f8bc31114 15/20: Change hash_idx_t to int32_t on all platforms |
Date: |
Sat, 13 Jan 2024 14:54:02 -0500 (EST) |
branch: master
commit 68f8bc3111424527205ebfe4498e5bebf50f50bf
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
Change hash_idx_t to int32_t on all platforms
* src/lisp.h (hash_idx_t): Change to int32_t.
* src/fns.c (hash_index_size): Adapt to new index type.
---
src/fns.c | 3 ++-
src/lisp.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/fns.c b/src/fns.c
index 4a38126d9dc..3acbc7f86a1 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4515,7 +4515,8 @@ hash_index_size (ptrdiff_t size)
/* 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);
diff --git a/src/lisp.h b/src/lisp.h
index 5b70e96d6a1..f27f506b58f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2432,7 +2432,7 @@ verify (FIXNUM_OVERFLOW_P (hash_unused));
/* 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
{
- master d2c3a983146 20/20: Hash-table documentation updates (bug#68244), (continued)
- master d2c3a983146 20/20: Hash-table documentation updates (bug#68244), Mattias Engdegård, 2024/01/13
- master a09619f2598 02/20: * src/print.c (print_object): Don't print empty hash-table data, Mattias Engdegård, 2024/01/13
- master 3f9c81a87f7 03/20: Don't print or read the hash table size parameter, Mattias Engdegård, 2024/01/13
- master d3cefd3e983 06/20: Leaner hash table dumping and thawing, Mattias Engdegård, 2024/01/13
- master 519c7ca7356 19/20: Don't pretend that hash-table-size is useful, Mattias Engdegård, 2024/01/13
- master 3b00255a4c7 10/20: Inlined and specialised hash table look-up, Mattias Engdegård, 2024/01/13
- master 1998039f7a8 18/20: Change hash_hash_t to uint32_t, Mattias Engdegård, 2024/01/13
- master 7d93a0147a1 12/20: Share hash table test structs, Mattias Engdegård, 2024/01/13
- master 47502c55b0c 13/20: ; Reorder struct Lisp_Hash_Table and struct hash_table_test, Mattias Engdegård, 2024/01/13
- master c6bdc1ea1dc 04/20: Represent hash table weakness as an enum internally, Mattias Engdegård, 2024/01/13
- master 68f8bc31114 15/20: Change hash_idx_t to int32_t on all platforms,
Mattias Engdegård <=
- master 0a998938ca1 11/20: Use hash_idx_t for storing hash indices, Mattias Engdegård, 2024/01/13
- master 11e467eb600 17/20: Use key Qunbound instead of hash value hash_unused for free entries, Mattias Engdegård, 2024/01/13