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.
  (if (not (= (length form) 3))
      (byte-compile-subr-wrong-args form "1 or more")
    (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))))