From 79a99818c9b8634356c65eb3a6bff7c5801bf780 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Thu, 24 May 1990 17:30:33 +0000
Subject: [PATCH] In FAST-ASH/FIXNUM, when shifting right, we must negate N
 before considering it to be a right shift amount.

---
 compiler/old-rt/arith.lisp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler/old-rt/arith.lisp b/compiler/old-rt/arith.lisp
index d3b855d0a..819701642 100644
--- a/compiler/old-rt/arith.lisp
+++ b/compiler/old-rt/arith.lisp
@@ -126,9 +126,10 @@
 	       (inst sli16 r (- n 16))
 	       (inst sli r n)))
 	  ((minusp n)
-	   (if (> n 15)
-	       (inst sari16 r (- n 16))
-	       (inst sari r n))))
+	   (let ((n (- n)))
+	     (if (> n 15)
+		 (inst sari16 r (- n 16))
+		 (inst sari r n)))))
 
     (unless (location= i r)
       (inst lr r i))))
-- 
GitLab