emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] feature/byte-switch 245fb25: ; src/bytecode.c (exec_byte_c


From: Vibhav Pant
Subject: [Emacs-diffs] feature/byte-switch 245fb25: ; src/bytecode.c (exec_byte_code): Refactor byte-switch code.
Date: Sat, 11 Feb 2017 10:07:45 -0500 (EST)

branch: feature/byte-switch
commit 245fb2529bc4394003a020d6c43b8bcc1d6237ba
Author: Vibhav Pant <address@hidden>
Commit: Vibhav Pant <address@hidden>

    ; src/bytecode.c (exec_byte_code): Refactor byte-switch code.
    
    Remove unnecessary asserts, remove duplicate code.
---
 src/bytecode.c | 35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/src/bytecode.c b/src/bytecode.c
index 29674a0..8bc1ecf 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;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]