excl:shorts-to-single-float examples?

Eric Moss <[email protected]> Thu, 29 Jun 2006 23:59:15 -0500
Newsgroups gmane.lisp.allegro
Message-ID <[email protected]>
Hi again,

Sorry for my denseness--I figured out the use of excl:shorts-to- 
single-float.  It may be lame, not paying attention to endianness or  
anything, but here it is, in case it saves anyone some time:

;;; read a (big-endian, I think) 32 bit float from stream 'in'
(defun read-f4 (in)
   (let ((hi #x0000)
         (lo #x0000))
     (setf (ldb (byte 8 8) hi) (read-byte in))
     (setf (ldb (byte 8 0) hi) (read-byte in))
     (setf (ldb (byte 8 8) lo) (read-byte in))
     (setf (ldb (byte 8 0) lo) (read-byte in))
     (excl:shorts-to-single-float hi lo)))


Eric