summaryrefslogtreecommitdiff
path: root/src/bytecode.c
diff options
context:
space:
mode:
authorVibhav Pant <vibhavp@gmail.com>2017-02-11 20:36:30 +0530
committerVibhav Pant <vibhavp@gmail.com>2017-02-11 20:36:30 +0530
commit245fb2529bc4394003a020d6c43b8bcc1d6237ba (patch)
tree08c7725d0e089e8a3a44982844875eeadb572784 /src/bytecode.c
parent7c2d493540b6e2e1661397812c5ed9fcff04e36c (diff)
downloademacs-245fb2529bc4394003a020d6c43b8bcc1d6237ba.tar.gz
; src/bytecode.c (exec_byte_code): Refactor byte-switch code.
Remove unnecessary asserts, remove duplicate code.
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 29674a0d9de..8bc1ecfeaa5 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1431,29 +1431,22 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
{ /* Do a linear search if there are not many cases
FIXME: 5 is arbitrarily chosen. */
EMACS_UINT hash_code = h->test.hashfn (&h->test, v1);
- for (i = 0; i < h->count; i++)
- {
- if (BYTE_CODE_SAFE)
- eassert (!NILP (HASH_HASH (h, i)));
-
- if (EQ (v1, HASH_KEY (h, i))
- || (h->test.cmpfn
- && hash_code == XUINT (HASH_HASH (h, i))
- && h->test.cmpfn (&h->test, v1, HASH_KEY (h, i))))
- {
- op = XINT (HASH_VALUE (h, i));
- goto op_branch;
- }
- }
+ for (i = h->count; 0 <= --i;)
+ if (EQ (v1, HASH_KEY (h, i))
+ || (h->test.cmpfn
+ && hash_code == XUINT (HASH_HASH (h, i))
+ && h->test.cmpfn (&h->test, v1, HASH_KEY (h, i))))
+ break;
+
}
else
- {
- i = hash_lookup(h, v1, NULL);
- if (i >= 0) {
- op = XINT(HASH_VALUE (h, i));
- goto op_branch;
- }
- }
+ i = hash_lookup(h, v1, NULL);
+
+ if (i >= 0)
+ {
+ op = XINT (HASH_VALUE (h, i));
+ goto op_branch;
+ }
}
NEXT;