Function: calc-word-size
calc-word-size is an autoloaded, interactive and byte-compiled
function defined in calc-bin.el.gz.
Signature
(calc-word-size N)
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-bin.el.gz
(defun calc-word-size (n)
(interactive "P")
(calc-wrapper
(or n (setq n (read-string (format-prompt "Binary word size"
calc-word-size))))
(setq n (if (stringp n)
(if (equal n "")
calc-word-size
(if (string-match "\\`[-+]?[0-9]+\\'" n)
(string-to-number n)
(error "Expected an integer")))
(prefix-numeric-value n)))
(or (= n calc-word-size)
(if (> (math-abs n) 100)
(calc-change-mode 'calc-word-size n calc-leading-zeros)
(calc-change-mode '(calc-word-size calc-previous-modulo)
(list n (math-power-of-2 (math-abs n)))
calc-leading-zeros)))
(setq math-2-word-size (math-power-of-2 (math-abs n)))
(setq math-half-2-word-size (math-power-of-2 (1- (math-abs n))))
(calc-do-refresh)
(calc-refresh-evaltos)
(cond
((< n 0) (message "Binary word size is %d bits (two's complement)" (- n)))
((> n 0) (message "Binary word size is %d bits" n))
(t (message "No fixed binary word size")))))