diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-07-26 09:40:02 +0200 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-07-26 09:40:02 +0200 |
commit | 7a161dc688f0eeee64e307a55efbc7d11bab3627 (patch) | |
tree | 127cd6d6257e8e484a7021b12790610d308f7594 /lisp/emacs-lisp/byte-opt.el | |
parent | 79ed90380547128b9919d407901a886fed0306b7 (diff) | |
parent | 9f01ce6327af886f26399924a9aadf16cdd4fd9f (diff) | |
download | emacs-7a161dc688f0eeee64e307a55efbc7d11bab3627.tar.gz emacs-7a161dc688f0eeee64e307a55efbc7d11bab3627.tar.bz2 emacs-7a161dc688f0eeee64e307a55efbc7d11bab3627.zip |
Merge remote-tracking branch 'savahnna/master' into HEAD
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 194ceee176f..6f801be5457 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -709,6 +709,9 @@ (integer (if integer-is-first arg1 arg2)) (other (if integer-is-first arg2 arg1))) (list (if (eq integer 1) '1+ '1-) other))) + ;; (+ x y z) -> (+ (+ x y) z) + ((= (length args) 3) + `(+ ,(byte-optimize-plus `(+ ,(car args) ,(cadr args))) ,@(cddr args))) ;; not further optimized ((equal args (cdr form)) form) (t (cons '+ args))))) @@ -737,6 +740,9 @@ ((and (null (cdr args)) (numberp (car args))) (- (car args))) + ;; (- x y z) -> (- (- x y) z) + ((= (length args) 3) + `(- ,(byte-optimize-minus `(- ,(car args) ,(cadr args))) ,@(cddr args))) ;; not further optimized ((equal args (cdr form)) form) (t (cons '- args)))))) @@ -764,6 +770,10 @@ ((null args) 1) ;; (* n) -> n, where n is a number ((and (null (cdr args)) (numberp (car args))) (car args)) + ;; (* x y z) -> (* (* x y) z) + ((= (length args) 3) + `(* ,(byte-optimize-multiply `(* ,(car args) ,(cadr args))) + ,@(cddr args))) ;; not further optimized ((equal args (cdr form)) form) (t (cons '* args))))) |