[movitz-cvs] CVS ia-x86
ffjeld
ffjeld at common-lisp.net
Mon Feb 26 22:14:00 UTC 2007
Update of /project/movitz/cvsroot/ia-x86
In directory clnet:/tmp/cvs-serv9316
Modified Files:
codec.lisp
Log Message:
Have sign-extend-complex deal correctly with bytes of size 0.
--- /project/movitz/cvsroot/ia-x86/codec.lisp 2005/08/13 20:24:04 1.7
+++ /project/movitz/cvsroot/ia-x86/codec.lisp 2007/02/26 22:14:00 1.8
@@ -9,7 +9,7 @@
;;;; Created at: Thu May 4 15:16:45 2000
;;;; Distribution: See the accompanying file COPYING.
;;;;
-;;;; $Id: codec.lisp,v 1.7 2005/08/13 20:24:04 ffjeld Exp $
+;;;; $Id: codec.lisp,v 1.8 2007/02/26 22:14:00 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
@@ -672,10 +672,13 @@
that byte (i.e. #c(255 1) => -1)."
(let ((old-byte (realpart cdatum))
(numo (imagpart cdatum)))
- (if (zerop (ldb (byte 1 (1- (* 8 numo))) old-byte))
- cdatum
- (complex (- old-byte (dpb 1 (byte 1 (* 8 numo)) 0))
- numo))))
+ (cond
+ ((= 0 numo)
+ 0)
+ ((zerop (ldb (byte 1 (1- (* 8 numo))) old-byte))
+ cdatum)
+ (t (complex (- old-byte (dpb 1 (byte 1 (* 8 numo)) 0))
+ numo)))))
(defun sign-extend (old-byte numo)
"Given a two's complement signed byte (where the most significant
More information about the Movitz-cvs
mailing list