X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fbit-util.lisp;h=ca564bb80684daa4aafcb79a983e11846ec70315;hb=0e3c4b4db102bd204a30402d7e5a0de44aea57ce;hp=0bc749839bfa8dca62547f2c6ea9a921e464caa6;hpb=c2431e2d0d0222a3cf20cfdfa48201bdcc65cd76;p=sbcl.git diff --git a/src/compiler/bit-util.lisp b/src/compiler/bit-util.lisp index 0bc7498..ca564bb 100644 --- a/src/compiler/bit-util.lisp +++ b/src/compiler/bit-util.lisp @@ -19,37 +19,19 @@ ;;; Clear a SIMPLE-BIT-VECTOR to zeros. (defun clear-bit-vector (vec) (declare (type simple-bit-vector vec)) - (bit-xor vec vec t)) - -;;; The old (pre-1999) code had a more-efficient-looking, but also -;;; less-portable implementation of CLEAR-BIT-VECTOR: -;;; (do ((i sb!vm:vector-data-offset (1+ i)) -;;; (end (+ sb!vm:vector-data-offset -;;; (ash (+ (length vec) (1- sb!vm:n-word-bits)) -;;; (- (1- (integer-length sb!vm:n-word-bits))))))) -;;; ((= i end) vec) -;;; (setf (sb!kernel:%raw-bits vec i) 0))) -;;; We could use this in the target SBCL if the new version turns out to be a -;;; bottleneck. I (WHN 19990321) will stick to the portable version for now. -;;; And by the way, if we do revisit this file with efficiency on our mind, it -;;; might be good to check whether it's really that helpful to implement -;;; all these functions as INLINE. (How expensive can it be to call a -;;; 1-argument function? How expensive is it to fill up our cache with -;;; a bunch of redundant loop expansions?) -;;; -;;; FIXME: Perhaps do simple benchmarks against CMU CL to check this. + (fill vec 0)) ;;; Fill a bit vector with ones. (defun set-bit-vector (vec) (declare (type simple-bit-vector vec)) - (bit-orc2 vec vec t)) + (fill vec 1)) ;;; Replace the bits in To with the bits in From. (defun bit-vector-replace (to from) (declare (type simple-bit-vector to from)) - (bit-ior from from to)) + (replace to from)) ;;; Copy a bit-vector. (defun bit-vector-copy (vec) (declare (type simple-bit-vector vec)) - (bit-ior vec vec (make-array (length vec) :element-type 'bit))) + (copy-seq vec))