[movitz-cvs] CVS update: movitz/losp/muerte/integers.lisp

Update of /project/movitz/cvsroot/movitz/losp/muerte In directory common-lisp.net:/tmp/cvs-serv12001 Modified Files: integers.lisp Log Message: Changed the bytespec representation back to integers. The longest bignum is (expt 2 20) bits, so that's what we use for the position. Most bytespec's sizes will fit in the 9 bits remaining in a fixnum. Date: Sun Sep 18 17:58:10 2005 Author: ffjeld Index: movitz/losp/muerte/integers.lisp diff -u movitz/losp/muerte/integers.lisp:1.118 movitz/losp/muerte/integers.lisp:1.119 --- movitz/losp/muerte/integers.lisp:1.118 Sun Sep 18 17:09:22 2005 +++ movitz/losp/muerte/integers.lisp Sun Sep 18 17:58:09 2005 @@ -9,7 +9,7 @@ ;;;; Created at: Wed Nov 8 18:44:57 2000 ;;;; Distribution: See the accompanying file COPYING. ;;;; -;;;; $Id: integers.lisp,v 1.118 2005/09/18 15:09:22 ffjeld Exp $ +;;;; $Id: integers.lisp,v 1.119 2005/09/18 15:58:09 ffjeld Exp $ ;;;; ;;;;------------------------------------------------------------------ @@ -1396,13 +1396,15 @@ ;;; bytes (defun byte (size position) - (cons size position)) + (check-type size positive-fixnum) + (let ((position (check-the (unsigned-byte 20) position))) + (+ position (ash size 20)))) (defun byte-size (bytespec) - (car bytespec)) + (ash bytespec -20)) (defun byte-position (bytespec) - (cdr bytespec)) + (ldb (byte 20 0) bytespec)) (defun logbitp (index integer) (check-type index positive-fixnum)
participants (1)
-
ffjeld@common-lisp.net