From: Stefan Kangas Date: Mon, 17 Feb 2025 18:30:44 +0000 (+0100) Subject: Prefer '(evenp A)' to '(= 0 (logand A 1))' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3bacba4666eb83cce0b5d260a5719ef26c20580e;p=emacs.git 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. (cherry picked from commit 7c7cf3e8c88de6af91b110584f3aa8aff8011409) --- diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el index 1bb76c390ba..ac90d6b28ed 100644 --- a/lisp/calc/calc-arith.el +++ b/lisp/calc/calc-arith.el @@ -874,7 +874,7 @@ (defun calcFunc-dint (expr) (let ((types (math-possible-types expr))) (if (= types 1) 1 - (if (= (logand types 1) 0) 0 + (if (evenp types) 0 (math-reject-arg expr 'integerp 'quiet))))) (defun calcFunc-dnumint (expr) diff --git a/lisp/ps-print.el b/lisp/ps-print.el index d133e0bad67..0908eeb7b50 100644 --- a/lisp/ps-print.el +++ b/lisp/ps-print.el @@ -4605,7 +4605,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th (t nil)) (cond ((eq ps-even-or-odd-pages 'even-page) - (= (logand ps-page-postscript 1) 0)) + (evenp ps-page-postscript)) ((eq ps-even-or-odd-pages 'odd-page) (= (logand ps-page-postscript 1) 1)) (t) @@ -4615,7 +4615,7 @@ page-height == ((floor print-height ((th + ls) * zh)) * ((th + ls) * zh)) - th (defsubst ps-print-sheet-p () (setq ps-print-page-p (cond ((eq ps-even-or-odd-pages 'even-sheet) - (= (logand ps-page-sheet 1) 0)) + (evenp ps-page-sheet)) ((eq ps-even-or-odd-pages 'odd-sheet) (= (logand ps-page-sheet 1) 1)) (t)