(combine32u a3 a2 a1 a0) merges unsigned bytes, producing the 32-bit
unsigned interpretation of
Function:
(defun combine32u$inline (a3 a2 a1 a0) (declare (type (unsigned-byte 8) a3 a2 a1 a0)) (mbe :logic (logior (ash (nfix a3) 24) (ash (nfix a2) 16) (ash (nfix a1) 8) (nfix a0)) :exec (b* ((a3 (the (unsigned-byte 32) (ash a3 24))) (a2 (the (unsigned-byte 24) (ash a2 16))) (a1 (the (unsigned-byte 16) (ash a1 8))) (ans (the (unsigned-byte 16) (logior (the (unsigned-byte 16) a1) (the (unsigned-byte 8) a0)))) (ans (the (unsigned-byte 24) (logior (the (unsigned-byte 24) a2) (the (unsigned-byte 16) ans))))) (the (unsigned-byte 32) (logior (the (unsigned-byte 32) a3) (the (unsigned-byte 24) ans))))))
Theorem:
(defthm combine32u-unsigned-byte (implies (and (force (unsigned-byte-p 8 a3)) (force (unsigned-byte-p 8 a2)) (force (unsigned-byte-p 8 a1)) (force (unsigned-byte-p 8 a0))) (unsigned-byte-p 32 (combine32u a3 a2 a1 a0))))
Theorem:
(defthm combine32u-loghead-logtail (implies (natp i) (equal (combine32u (logtail 24 i) (loghead 8 (logtail 16 i)) (loghead 8 (logtail 8 i)) (loghead 8 i)) i)))