]> git.eshelyaron.com Git - emacs.git/commitdiff
; src/bytecode.c (exec_byte_code): Refactor byte-switch code.
authorVibhav Pant <vibhavp@gmail.com>
Sat, 11 Feb 2017 15:06:30 +0000 (20:36 +0530)
committerVibhav Pant <vibhavp@gmail.com>
Sat, 11 Feb 2017 15:06:30 +0000 (20:36 +0530)
Remove unnecessary asserts, remove duplicate code.

src/bytecode.c

index 29674a0d9de64ceb85d05eb4bb747e308f3548ae..8bc1ecfeaa565790811e7da27913b9c4f1d08342 100644 (file)
@@ -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;