Convert two hexadecimal digit characters to an unsigned 8-bit byte.
(hexchars=>ubyte8 hi-char lo-char) → byte
The most significant digit comes first, followed by the least significant one.
Function:
(defun hexchars=>ubyte8 (hi-char lo-char) (declare (xargs :guard (and (str::hex-digit-char-p hi-char) (str::hex-digit-char-p lo-char)))) (let ((__function__ 'hexchars=>ubyte8)) (declare (ignorable __function__)) (b* ((hi-digit (str::hex-digit-char-value hi-char)) (lo-digit (str::hex-digit-char-value lo-char))) (+ (* 16 hi-digit) lo-digit))))
Theorem:
(defthm return-type-of-hexchars=>ubyte8 (b* ((byte (hexchars=>ubyte8 hi-char lo-char))) (unsigned-byte-p 8 byte)) :rule-classes :rewrite)