Number of bits that forms a value of a C integer type.
Function:
(defun integer-type-bits (type) (declare (xargs :guard (typep type))) (declare (xargs :guard (type-integerp type))) (let ((__function__ 'integer-type-bits)) (declare (ignorable __function__)) (case (type-kind type) ((:char :schar :uchar) (char-bits)) ((:sshort :ushort) (short-bits)) ((:sint :uint) (int-bits)) ((:slong :ulong) (long-bits)) ((:sllong :ullong) (llong-bits)) (t (prog2$ (impossible) 1)))))
Theorem:
(defthm posp-of-integer-type-bits (b* ((bits (integer-type-bits type))) (posp bits)) :rule-classes :type-prescription)
Theorem:
(defthm integer-type-bits-of-type-fix-type (equal (integer-type-bits (type-fix type)) (integer-type-bits type)))
Theorem:
(defthm integer-type-bits-type-equiv-congruence-on-type (implies (type-equiv type type-equiv) (equal (integer-type-bits type) (integer-type-bits type-equiv))) :rule-classes :congruence)