[armedbear-cvs] r11956 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Tue May 26 20:46:16 UTC 2009


Author: ehuelsmann
Date: Tue May 26 16:46:15 2009
New Revision: 11956

Log:
Improved integer type derivation for MINUS
 - fixes some tests in ABCL's test suite.

Modified:
   trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

Modified: trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	(original)
+++ trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp	Tue May 26 16:46:15 2009
@@ -6188,8 +6188,18 @@
 value for use with derive-type-minus and derive-type-plus.")
 
 (define-int-bounds-derivation - (low1 high1 low2 high2)
-    (values (and low1 low2 (- low1 low2))
-            (and high1 high2 (- high1 high2))))
+  (values (when (and low1 high2) ;; low1 or high2 undefined: no lower bound
+            (if low2
+                (min (- low1 low2)
+                     (- low1 high2))
+                ;; low2 undefined: no effect on lower bound
+                (- low1 high2)))
+          (when (and high1 low2) ;; high1 or low2 undefined: no upper bound
+            (if high2
+                (max (- high1 low2)
+                     (- high1 high2))
+                ;; high2 undefined: no effect on upper bound
+                (- high1 low2)))))
 
 (defun derive-compiler-types (args op)
   (flet ((combine (x y)




More information about the armedbear-cvs mailing list