Function: calcFunc-ash
calcFunc-ash is an autoloaded and byte-compiled function defined in
calc-bin.el.gz.
Signature
(calcFunc-ash A &optional N W)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-bin.el.gz
(defun calcFunc-ash (a &optional n w) ; [I I] [Public]
(if (or (null n)
(not (Math-negp n)))
(calcFunc-lsh a n w)
(setq a (math-trunc a)
n (if n (math-trunc n) 1))
(if (eq (car-safe a) 'mod)
(math-binary-modulo-args 'calcFunc-ash a n w)
(setq w (if w (math-trunc w) calc-word-size))
(or (integerp w)
(math-reject-arg w 'fixnump))
(or (Math-integerp a)
(math-reject-arg a 'integerp))
(or (Math-integerp n)
(math-reject-arg n 'integerp))
(if (< w 0)
(math-clip (calcFunc-ash a n (- w)) w)
(if (Math-integer-negp a)
(setq a (math-clip a w)))
(let ((two-to-sizem1 (and (not (zerop w)) (math-power-of-2 (1- w))))
(sh (calcFunc-lsh a n w)))
(cond ((or (zerop w)
(zerop (logand a two-to-sizem1)))
sh)
((Math-lessp n (- 1 w))
(math-add (math-mul two-to-sizem1 2) -1))
(t (let ((two-to-n (math-power-of-2 (- n))))
(math-add (calcFunc-lsh (math-add two-to-n -1)
(+ w n) w)
sh)))))))))