[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/byte-switch 13eabbd: bytecode.c (exec_byte_code):
From: |
Vibhav Pant |
Subject: |
[Emacs-diffs] feature/byte-switch 13eabbd: bytecode.c (exec_byte_code): Use h->count instead of HASH_TABLE_SIZE |
Date: |
Thu, 9 Feb 2017 08:43:57 -0500 (EST) |
branch: feature/byte-switch
commit 13eabbd80b121d0b86de55321bd5dda5d99fb857
Author: Vibhav Pant <address@hidden>
Commit: Vibhav Pant <address@hidden>
bytecode.c (exec_byte_code): Use h->count instead of HASH_TABLE_SIZE
---
src/bytecode.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/bytecode.c b/src/bytecode.c
index fb10a6d..299c651 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1425,10 +1425,17 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object
vector, Lisp_Object maxdepth,
#endif
ptrdiff_t i;
struct Lisp_Hash_Table *h = XHASH_TABLE(jmp_table);
- if (HASH_TABLE_SIZE (h) <= 5)
+
+#ifdef BYTE_CODE_SAFE
+ /* Hash tables for switch are declared with :size set to exact
+ number of cases, so this should always be true. */
+ eassert (HASH_TABLE_SIZE (h) == h->count);
+#endif
+
+ if (h->count <= 5)
{ /* Do a linear search if there are not many cases
FIXME: 5 is arbitrarily chosen. */
- for (i = 0; i < HASH_TABLE_SIZE (h); i++)
+ for (i = 0; i < h->count; i++)
{
#ifdef BYTE_CODE_SAFE
eassert (!NILP (HASH_HASH (h, i)));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] feature/byte-switch 13eabbd: bytecode.c (exec_byte_code): Use h->count instead of HASH_TABLE_SIZE,
Vibhav Pant <=