Recognizer for signed integers that fit in a specified bit width
(Signed-byte-p bits x) is T when bits is a positive
integer and x is a signed integer whose 2's complement representation
fits in a bit-width of bits, i.e., -2^(bits-1) <= x <
Note that a type-spec of (signed-byte i) for a variable x
in a function's declare form translates to a guard condition of
(signed-byte-p i x).
The guard for signed-byte-p is T.
(defun signed-byte-p (bits x)
(declare (xargs :guard t))
(and (integerp bits)
(< 0 bits)
(let ((y (expt 2 (1- bits))))
(integer-range-p (- y) y x))))