From 139059d9b46fb9bf832cd0a1733c6c27382cf245 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Fri, 13 Mar 1992 23:17:03 +0000
Subject: [PATCH] Avoid repeated calls to MOD when searching down a collision
 chain in COMPACT-INFO-LOOKUP.

---
 compiler/globaldb.lisp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/compiler/globaldb.lisp b/compiler/globaldb.lisp
index 3ba6acab6..e39190032 100644
--- a/compiler/globaldb.lisp
+++ b/compiler/globaldb.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/globaldb.lisp,v 1.22 1992/03/11 21:21:28 wlott Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/globaldb.lisp,v 1.23 1992/03/13 23:17:03 ram Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -587,9 +587,16 @@
 	 (len (length table))
 	 (len-2 (- len 2))
 	 (hash2 (- len-2 (rem hash len-2))))
+    (declare (type index len-2 hash2))
     (macrolet ((lookup (test)
 		 `(do ((probe (rem hash len)
-			      (rem (+ probe hash2) len)))
+			      (let ((new (+ probe hash2)))
+				(declare (type index new))
+				;;
+				;; same as (mod new len), but faster.
+				(if (>= new len)
+				    (the index (- new len))
+				    new))))
 		      (nil)
 		    (let ((entry (svref table probe)))
 		      (when (eql entry 0)
-- 
GitLab