From 5fc4061d56fe2e996f25a1220711787c7d6b72fe Mon Sep 17 00:00:00 2001
From: wlott <wlott>
Date: Sun, 28 Apr 1991 01:10:29 +0000
Subject: [PATCH] Fixed the case where we were iterating from the right to the
 left and we only needed to read one word of the source to compute the
 rightmost dst word.  We were reading two words which made load seg-fault
 because next src word was on a different page (that wasn't mapped in).

---
 code/bit-bash.lisp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/code/bit-bash.lisp b/code/bit-bash.lisp
index b7201a434..d17a531cc 100644
--- a/code/bit-bash.lisp
+++ b/code/bit-bash.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/bit-bash.lisp,v 1.10 1991/04/23 01:24:29 wlott Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/bit-bash.lisp,v 1.11 1991/04/28 01:10:29 wlott Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -381,7 +381,7 @@
 	      ;; We need to loop from right to left.
 	      (incf dst-word-offset words)
 	      (incf src-word-offset
-		    (floor (+ src-bit-offset length) unit-bits))
+		    (1- (ceiling (+ src-bit-offset length) unit-bits)))
 	      (let ((next 0)
 		    (prev (funcall src-ref-fn src src-word-offset)))
 		(declare (type unit prev next))
@@ -391,7 +391,7 @@
 					   (decf src-word-offset)))))
 		  (declare (inline get-next-src))
 		  (unless (zerop final-bits)
-		    (unless (> (- unit-bits src-shift) final-bits)
+		    (when (> final-bits (- unit-bits src-shift))
 		      (get-next-src))
 		    (let ((value (32bit-logical-or
 				  (shift-towards-end next (- src-shift))
-- 
GitLab