summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2025-02-17 19:30:44 +0100
committerStefan Kangas <stefankangas@gmail.com>2025-02-17 19:30:44 +0100
commit7c7cf3e8c88de6af91b110584f3aa8aff8011409 (patch)
treed33dd28c9cf9fe024c296e61823ccd9e235c22e7 /lisp/emacs-lisp
parent1a8493f0a5fcd45c7e992dbf42cfbb0346edcaff (diff)
downloademacs-7c7cf3e8c88de6af91b110584f3aa8aff8011409.tar.gz
emacs-7c7cf3e8c88de6af91b110584f3aa8aff8011409.tar.bz2
emacs-7c7cf3e8c88de6af91b110584f3aa8aff8011409.zip
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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el2
-rw-r--r--lisp/emacs-lisp/elint.el2
2 files changed, 2 insertions, 2 deletions
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)