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.
This commit is contained in:
parent
1a8493f0a5
commit
7c7cf3e8c8
5 changed files with 6 additions and 6 deletions
|
@ -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)
|
||||
|
|
|
@ -1601,7 +1601,7 @@ To use this, apply a binary operator (evaluate it), then call this."
|
|||
(overflow-error
|
||||
;; X and Y must be integers, as expt silently returns floating-point
|
||||
;; infinity on floating-point overflow.
|
||||
(if (or (natnump x) (zerop (logand y 1)))
|
||||
(if (or (natnump x) (evenp y))
|
||||
1.0e+INF
|
||||
-1.0e+INF))))
|
||||
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue