X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fbyte-optimize.el;h=c84fd233718771a7b25d43e2c09ea74cd0e20eb9;hb=3ca93f4c76fca3afcbe47893ef6ac97b12a9c30b;hp=f591e82d5c6710e6aa800aee828cb8932e001ff1;hpb=0c693dc08f0794304711787b2eb47c144ea4bef1;p=chise%2Fxemacs-chise.git- diff --git a/lisp/byte-optimize.el b/lisp/byte-optimize.el index f591e82..c84fd23 100644 --- a/lisp/byte-optimize.el +++ b/lisp/byte-optimize.el @@ -704,7 +704,7 @@ ;;; is not a marker or if it appears in other arithmetic). ;;; But this degree of paranoia is normally unjustified, so optimize unless -;;; the user has done (declaim (safety 3)). Implemented in bytecomp.el. +;;; the user has done (declaim (optimize (safety 3))). See bytecomp.el. (defun byte-optimize-plus (form) (byte-optimize-predicate (byte-optimize-delay-constants-math form 1 '+))) @@ -729,9 +729,15 @@ (decf (nth 1 form) last) (butlast form)) - ;; (- 0 x ...) --> (- (- x) ...) - ((and (eq 0 (nth 1 form)) (>= (length form) 3)) - `(- (- ,(nth 2 form)) ,@(nthcdr 3 form))) + ;; (- 0 ...) --> + ((eq 0 (nth 1 form)) + (case (length form) + ;; (- 0) --> 0 + (2 0) + ;; (- 0 x) --> (- x) + (3 `(- ,(nth 2 form))) + ;; (- 0 x y ...) --> (- (- x) y ...) + (t `(- (- ,(nth 2 form)) ,@(nthcdr 3 form))))) (t (byte-optimize-predicate form))))) @@ -849,13 +855,13 @@ (put 'max 'byte-optimizer 'byte-optimize-associative-math) (put 'min 'byte-optimizer 'byte-optimize-associative-math) -(put '= 'byte-optimizer 'byte-optimize-binary-predicate) (put 'eq 'byte-optimizer 'byte-optimize-binary-predicate) (put 'eql 'byte-optimizer 'byte-optimize-binary-predicate) (put 'equal 'byte-optimizer 'byte-optimize-binary-predicate) (put 'string= 'byte-optimizer 'byte-optimize-binary-predicate) (put 'string-equal 'byte-optimizer 'byte-optimize-binary-predicate) +(put '= 'byte-optimizer 'byte-optimize-predicate) (put '< 'byte-optimizer 'byte-optimize-predicate) (put '> 'byte-optimizer 'byte-optimize-predicate) (put '<= 'byte-optimizer 'byte-optimize-predicate)