Function: math-clip

math-clip is an autoloaded and byte-compiled function defined in calc-bin.el.gz.

Signature

(math-clip A &optional W)

Aliases

calcFunc-clip

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-bin.el.gz
(defun math-clip (a &optional w)   ; [I I] [Public]
  (cond ((Math-messy-integerp w)
	 (math-clip a (math-trunc w)))
	((eq (car-safe a) 'mod)
	 (math-binary-modulo-args 'math-clip a nil w))
	((and w (not (integerp w)))
	 (math-reject-arg w 'fixnump))
	((not (Math-num-integerp a))
	 (math-reject-arg a 'integerp))
	((< (or w (setq w calc-word-size)) 0)
	 (setq a (math-clip a (- w)))
	 (if (< a (math-power-of-2 (- -1 w)))
	     a
	   (math-sub a (math-power-of-2 (- w)))))
        ((math-zerop w)
         a)
	((Math-negp a)
	 (math-binary-arg a w))
	((integerp a)
	 (logand a (1- (ash 1 w))))))