(cal-tex-cmd "\\pagestyle" "empty")
(dotimes (i n)
(dotimes (j 4)
- (let ((even (zerop (% j 2))))
+ (let ((even (evenp j)))
(insert (if even
"\\righthead"
"\\lefthead"))
option `todo-categories-align'."
(let* ((len (todo-adjusted-category-label-length))
(strlen (length str))
- (strlen-odd (eq (logand strlen 1) 1))
+ (strlen-odd (oddp strlen))
(padding (max 0 (/ (- len strlen) 2)))
(padding-left (cond ((eq todo-categories-align 'left) 0)
((eq todo-categories-align 'center) padding)
;; Backslash-escaped: no pairing, no skipping.
((save-excursion
(goto-char beg)
- (not (zerop (% (skip-syntax-backward "\\") 2))))
+ (oddp (skip-syntax-backward "\\")))
(let ((current-prefix-arg (1- num)))
(electric-pair-post-self-insert-function)))
;; Skip self.
;; 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))))
"Return t if NUMBER is negative."
(< number 0))
-(defun cl-oddp (integer)
- "Return t if INTEGER is odd."
- (eq (logand integer 1) 1))
+(defalias 'cl-oddp 'oddp)
-(defun cl-evenp (integer)
- "Return t if INTEGER is even."
- (eq (logand integer 1) 0))
+(defalias 'cl-evenp 'evenp)
(defconst cl-digit-char-table
(let* ((digits (make-vector 256 nil))
"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)
\(fn PLACE VAL PLACE VAL ...)"
(declare (debug (&rest [gv-place form])))
- (if (/= (logand (length args) 1) 0)
- (signal 'wrong-number-of-arguments (list 'setf (length args))))
+ (unless (evenp (length args))
+ (signal 'wrong-number-of-arguments (list 'setf (length args))))
(if (and args (null (cddr args)))
(let ((place (pop args))
(val (car args)))
;; Malformed code is translated to code that signals an error
;; at run time.
(let ((nargs (length args)))
- (if (/= (logand nargs 1) 0)
+ (if (oddp nargs)
(macroexp-warn-and-return
(format-message "odd number of arguments in `setq' form")
`(signal 'wrong-number-of-arguments '(setq ,nargs))
"Format MSG according to ARGS.
See also `format-spec'."
- (when (eq (logand (length args) 1) 1) ; oddp
+ (when (oddp (length args))
(error "Obscure usage of this function appeared"))
(let ((entry (erc-retrieve-catalog-entry msg)))
(when (not entry)
(while (search-forward "\"" nil t)
(when (prog2
(backward-char)
- (zerop (% (skip-chars-backward "\\\\") 2))
+ (evenp (skip-chars-backward "\\\\"))
(goto-char (match-beginning 0)))
(insert "\\"))
(forward-char))
(let ((chars '()))
(let ((len (length str))
(idx 0))
- (if (eq (logand len 1) 1)
+ (if (oddp len)
(let ((num (hexl-hex-string-to-integer (substring str 0 1))))
(setq chars (cons num chars))
(setq idx 1)))
((eq keyword :repeat) (setq repeat (pop defs)))
(t (push keyword opts)
(push (pop defs) opts)))))
- (unless (zerop (% (length defs) 2))
+ (unless (evenp (length defs))
(error "Uneven number of key/definition pairs: %s" defs))
(let ((defs defs)
end (match-end 0)
words nil)
(while match
- (push (list (match-string 2) ;; charset
+ (push (list (match-string 2) ;; charset
(char-after (match-beginning 3)) ;; encoding
- (substring (match-string 3) 2) ;; encoded-text
- (match-string 1)) ;; encoded-word
+ (substring (match-string 3) 2) ;; encoded-text
+ (match-string 1)) ;; encoded-word
words)
;; Look for the subsequent encoded-words.
(when (setq match (looking-at eword-regexp))
(while (search-forward "\"" end t)
(when (prog2
(backward-char)
- (zerop (% (skip-chars-backward "\\\\") 2))
+ (evenp (skip-chars-backward "\\\\"))
(goto-char (match-beginning 0)))
(insert "\\"))
(forward-char))
(defun plistp (object)
"Non-nil if and only if OBJECT is a valid plist."
(declare (pure t) (side-effect-free error-free))
- (let ((len (proper-list-p object)))
- (and len (zerop (% len 2)))))
+ (let ((len (proper-list-p object))) (and len (evenp len))))
(defun macrop (object)
"Non-nil if and only if OBJECT is a macro."
(funcall (car funs) (funcall (apply #'compose (cdr funs)) x)))
#'identity))
+(defsubst plusp (number) "Return t if NUMBER is positive." (> number 0))
+
+(defsubst minusp (number) "Return t if NUMBER is negative." (< number 0))
+
+(defun oddp (integer) "Return t if INTEGER is odd." (eq (logand integer 1) 1))
+
+(defun evenp (integer) "Return t if INTEGER is even." (eq (logand integer 1) 0))
+
;;; subr.el ends here