[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/10: Fix type inference of integer division
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/10: Fix type inference of integer division |
Date: |
Mon, 01 Feb 2016 14:35:29 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit f61870979c38bcdba48b3c28d748a3e17c1a7d3f
Author: Andy Wingo <address@hidden>
Date: Sun Jan 17 16:58:36 2016 +0100
Fix type inference of integer division
* module/language/cps/types.scm (define-binary-result!): Fix inference
of integer division.
---
module/language/cps/types.scm | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/module/language/cps/types.scm b/module/language/cps/types.scm
index a58953d..4adb8a8 100644
--- a/module/language/cps/types.scm
+++ b/module/language/cps/types.scm
@@ -978,13 +978,17 @@ minimum, and maximum."
((and closed? (eqv? a-type &exact-integer) (eqv? b-type &exact-integer))
(define! result &exact-integer min* max*))
(else
- ;; Fractions may become integers.
- (let ((type (logior a-type b-type)))
- (define! result
- (if (zero? (logand type &fraction))
- type
- (logior type &exact-integer))
- min* max*))))))
+ (let* ((type (logior a-type b-type))
+ ;; Fractions may become integers.
+ (type (if (zero? (logand type &fraction))
+ type
+ (logior type &exact-integer)))
+ ;; Integers may become fractions under division.
+ (type (if (or closed?
+ (zero? (logand type (logior &exact-integer))))
+ type
+ (logior type &fraction))))
+ (define! result type min* max*))))))
(define-simple-type-checker (add &number &number))
(define-type-aliases add add/immediate)
- [Guile-commits] branch master updated (ee85113 -> 5fceaed), Andy Wingo, 2016/02/01
- [Guile-commits] 05/10: Dist the prebuilt .go files, Andy Wingo, 2016/02/01
- [Guile-commits] 02/10: Fix cross-compilation of immediates to targets with different word sizes, Andy Wingo, 2016/02/01
- [Guile-commits] 01/10: Fix type inference of integer division,
Andy Wingo <=
- [Guile-commits] 10/10: Update NEWS., Andy Wingo, 2016/02/01
- [Guile-commits] 03/10: Distribute prebuilt bootstraps for common hosts, Andy Wingo, 2016/02/01
- [Guile-commits] 04/10: Fix uniform vector compilation to foreign byte orders., Andy Wingo, 2016/02/01
- [Guile-commits] 07/10: Frame <binding> objects capture frame, can ref value directly, Andy Wingo, 2016/02/01
- [Guile-commits] 08/10: Better call-counting profiles in statprof, Andy Wingo, 2016/02/01
- [Guile-commits] 06/10: Remove frame-local-ref, frame-local-set!, Andy Wingo, 2016/02/01
- [Guile-commits] 09/10: Update statprof documentation; deprecate `with-statprof', Andy Wingo, 2016/02/01