From 7c7cf3e8c88de6af91b110584f3aa8aff8011409 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 17 Feb 2025 19:30:44 +0100 Subject: Prefer '(evenp A)' to '(= 0 (logand A 1))' * lisp/calc/calc-arith.el (calcFunc-dint): * lisp/calculator.el (calculator-expt): * lisp/emacs-lisp/bytecomp.el (byte-compile-unfold-bcf): * lisp/emacs-lisp/elint.el (elint-check-defcustom-form): * lisp/ps-print.el (ps-print-page-p): (ps-print-sheet-p): Prefer '(evenp A)' to '(= 0 (logand A 1))' and variations thereof. --- lisp/emacs-lisp/bytecomp.el | 2 +- lisp/emacs-lisp/elint.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e48cac6c9b1..88e45ddb868 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3772,7 +3772,7 @@ This assumes the function has the `important-return-value' property." ;; Add missing &optional (or &rest) arguments. (dotimes (_ (- (/ (1+ fmax2) 2) alen)) (byte-compile-push-constant nil))) - ((zerop (logand fmax2 1)) + ((evenp fmax2) (byte-compile-report-error (format "Too many arguments for inlined function %S" form)) (byte-compile-discard (- alen (/ fmax2 2)))) diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index b63bcd44edf..5ae8880167d 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -833,7 +833,7 @@ CODE can be a lambda expression, a macro, or byte-compiled code." "Lint the defcustom FORM in ENV." (if (and (> (length form) 3) ;; even no. of keyword/value args ? - (zerop (logand (length form) 1))) + (evenp (length form))) (elint-env-add-global-var (elint-form (nth 2 form) env) (car (cdr form))) (elint-error "Malformed variable declaration: %s" form) -- cgit v1.2.3