example of excl:shorts-to-single-float?

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

I'm trying to read from a binary file created by (someone somewhere)  
and am trying to read 32 bits as a single float.  My current (non- 
functional) version is:

(defun read-f4 (in)
   (let ((hi (make-array 16 :element-type 'bit))
         (lo (make-array 16 :element-type 'bit)))
     (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)))

I'm pulling my hair out trying to figure out what 'hi' and 'lo'  
really are supposed to be and how to create them--the docs for  
excl:shorts-to-single-float don't help me much.  Are there examples  
anywhere (endian-ness issues aside)?

Thanks,

Eric