(combine32s a3 a2 a1 a0) merges unsigned bytes, producing the 32-bit
signed interpretation of
Function:
(defun combine32s$inline (a3 a2 a1 a0) (declare (type (unsigned-byte 8) a3 a2 a1 a0)) (mbe :logic (logior (ash (fast-logext 8 (nfix a3)) 24) (ash (nfix a2) 16) (ash (nfix a1) 8) (nfix a0)) :exec (b* ((a3 (the (signed-byte 32) (ash (the (signed-byte 8) (fast-logext 8 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 (signed-byte 32) (logior (the (signed-byte 32) a3) (the (signed-byte 32) ans))))))
Theorem:
(defthm combine32s-signed-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))) (signed-byte-p 32 (combine32s a3 a2 a1 a0))))