Changeset 13251


Ignore:
Timestamp:
Dec 3, 2009, 6:33:58 PM (10 years ago)
Author:
gb
Message:

In (COMPILER-MACRO-FUNCTION +), if all args are fixnums and the result
type is FIXNUM, ensure that all binary additions ignore overflow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/optimizers.lisp

    r13231 r13251  
    12221222      `(/=-2 ,n0 ,n1))))
    12231223
    1224 (define-compiler-macro + (&optional (n0 nil n0p) (n1 nil n1p) &rest more)
     1224(define-compiler-macro + (&optional (n0 nil n0p) (n1 nil n1p) &rest more &environment env)
    12251225  (if more
    1226     `(+ (+-2 ,n0 ,n1) ,@more)
     1226    (if (and (nx-trust-declarations env)
     1227             (subtypep *nx-form-type* 'fixnum)
     1228             (nx-form-typep n0 'fixnum env)
     1229             (nx-form-typep n1 'fixnum env)
     1230             (dolist (m more t)
     1231               (unless (nx-form-typep m 'fixnum env)
     1232                 (return nil))))
     1233      `(+-2 ,n0 (the fixnum (+ ,n1 ,@more)))
     1234      `(+ (+-2 ,n0 ,n1) ,@more))
    12271235    (if n1p
    12281236      `(+-2 ,n0 ,n1)
Note: See TracChangeset for help on using the changeset viewer.