From e1c22a2104a9cd6c09b61925d37a6cd0918eb9e0 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Tue, 26 Jul 2005 12:34:51 +0000
Subject: [PATCH] Add c::*enable-modular-arithmetic*, defaulting to T, that
 controls whether the compiler will do modular arithmetic optimizations when
 compiling code.

This allows a workaround for a bug noted by Martin Cracauer on
cmucl-imp, 2005/07/20.  Also works around an old bug on cmucl-help,
2004/11/03.
---
 compiler/srctran.lisp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/compiler/srctran.lisp b/compiler/srctran.lisp
index 348681b75..432f7a37b 100644
--- a/compiler/srctran.lisp
+++ b/compiler/srctran.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.159 2005/07/13 18:24:56 rtoy Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/srctran.lisp,v 1.160 2005/07/26 12:34:51 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -3977,6 +3977,12 @@
               nil		 ; After fixing above, replace with T.
               )))))))
 
+(defvar *enable-modular-arithmetic* t
+  "When non-NIL, the compiler will generate code utilizing modular
+  arithmetic.  Set to NIL to disable this, if you don't want modular
+  arithmetic in some cases.")
+
 #+modular-arith
 (defoptimizer (logand optimizer) ((x y) node)
-  (logand-defopt-helper x y node))
+  (when *enable-modular-arithmetic*
+    (logand-defopt-helper x y node)))
-- 
GitLab