- (setq form
-;;; It is not safe to delete the function entirely
-;;; (actually, it would be safe if we know the sole arg
-;;; is not a marker).
-;;; (if (eq (nth 2 form) 0)
-;;; (nth 1 form) ; (- x 0) --> x
- (byte-optimize-predicate
- (if (and (null (cdr (cdr (cdr form))))
- (eq (nth 1 form) 0)) ; (- 0 x) --> (- x)
- (cons (car form) (cdr (cdr form)))
- form))
-;;; )
- )
-
- ;; `add1' and `sub1' are a marginally fewer instructions than `plus'
- ;; and `minus', so use them when possible.
- (cond ((and (null (nthcdr 3 form))
- (eq (nth 2 form) 1))
- (list '1- (nth 1 form))) ; (- x 1) --> (1- x)
- ((and (null (nthcdr 3 form))
- (eq (nth 2 form) -1))
- (list '1+ (nth 1 form))) ; (- x -1) --> (1+ x)
- (t
- form))
- )
+
+ (case (length (cdr form))
+ ((0) ; (-)
+ (condition-case ()
+ (eval form)
+ (error form)))
+
+ ;; It is not safe to delete the function entirely
+ ;; (actually, it would be safe if we knew the sole arg
+ ;; is not a marker).
+ ;; ((1)
+ ;; (nth 1 form)
+
+ ((2) ; (+ x y)
+ (byte-optimize-predicate
+ (cond
+ ;; `add1' and `sub1' are a marginally fewer instructions than `plus'
+ ;; and `minus', so use them when possible.
+ ((eq (nth 2 form) 1) `(1- ,(nth 1 form))) ; (- x 1) --> (1- x)
+ ((eq (nth 2 form) -1) `(1+ ,(nth 1 form))) ; (- x -1) --> (1+ x)
+ ((eq (nth 1 form) 0) `(- ,(nth 2 form))) ; (- 0 x) --> (- x)
+ (t form))))
+
+ (t (byte-optimize-predicate form))))