[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read-byte question

I'm using: Allegro CL [Silicon Graphics Iris 4D] (8/7/90)
running on a SGI 4D/25TG, Irix 3.3.1.

Maybe I'm missing something obvious here,
I don't understand why the first read fails but the second works:

<cl> (setq qfile (open qfilename :direction :input :element-type '(signed-byte 32)))

#<stream reading /d1/u1/serafini/a3m/wt/q.5c.44 @ #x-fa650de> 
<cl> (read-byte qfile)
Error: nil is an illegal argument to *
[1] <cl> :res

<cl> (setq qfile (open qfilename :direction :input :element-type '(unsigned-byte 32)))

#<stream reading /d1/u1/serafini/a3m/wt/q.5c.44 @ #x-fa62cce> 
<cl> (read-byte qfile)


The value returned is correct. 16 is the first word in the file.
Alternatively, if someone could tell me how to push an (unsigned-byte 32)
that really is a negative number into a (signed-byte 32) without doing 
twos-complement arithmetic that would also solve the problem.



David B. Serafini			dbs@virgil.arc.nasa.gov
Rose Engineering and Research, Inc.	serafini@amelia.nas.nasa.gov
NASA/Ames Research Center MS 227-6	...!ames!amelia!serafini
Moffett Field, CA 94035			(415)604-6233