Function: byte-compile-cmp

byte-compile-cmp is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile-cmp FORM)

Documentation

Compile calls to numeric comparisons such as <, = etc.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-cmp (form)
  "Compile calls to numeric comparisons such as `<', `=' etc."
  ;; Lisp-level transforms should already have reduced valid calls to 2 args,
  ;; but optimizations may have been disabled.
  (let ((l (length form)))
    (cond
     ((= l 3)
      (byte-compile-two-args
       (if (macroexp-const-p (nth 1 form))
           ;; First argument is constant: flip it so that the constant
           ;; is last, which may allow more lapcode optimizations.
           (let* ((op (car form))
                  (flipped-op (cdr (assq op '((< . >) (<= . >=)
                                              (> . <) (>= . <=) (= . =))))))
             (list flipped-op (nth 2 form) (nth 1 form)))
         form)))
     ((= l 2) (byte-compile-form `(progn ,(nth 1 form) t)))
     (t (byte-compile-normal-call form)))))