1.0.2.9:
authorNathan Froyd <froydnj@cs.rice.edu>
Mon, 5 Feb 2007 03:47:01 +0000 (03:47 +0000)
committerNathan Froyd <froydnj@cs.rice.edu>
Mon, 5 Feb 2007 03:47:01 +0000 (03:47 +0000)
Micro-optimizations to the bignum code: use LOGTEST and LOGBITP
  where appropriate.

src/code/bignum.lisp
version.lisp-expr

index 29a69bc..6c5fa65 100644 (file)
     (declare (type (unsigned-byte #.sb!vm:n-word-bits) ud vd umask imask m))
     (dotimes (i digit-size)
       (setf umask (logior umask imask))
-      (unless (zerop (logand ud umask))
+      (when (logtest ud umask)
         (setf ud (modularly (- ud vd)))
         (setf m (modularly (logior m imask))))
       (setf imask (modularly (ash imask 1)))
     (declare (type (unsigned-byte #.(integer-length #.sb!vm:n-word-bits)) d)
              (type (unsigned-byte #.sb!vm:n-word-bits) n))
     (gcd-assert (>= d 0))
-    (unless (zerop (logand (%bignum-ref u 0) n))
+    (when (logtest (%bignum-ref u 0) n)
       (let ((tmp1-len
              (multiply-bignum-buffer-and-smallnum-to-buffer v v-len
                                                             (logand n (bmod u
 
     (cond
      ;; Round down if round bit is 0.
-     ((zerop (logand round-bit low))
+     ((not (logtest round-bit low))
       (float-from-bits shifted len))
      ;; If only round bit is set, then round to even.
      ((and (= low round-bit)
         (floor index digit-size)
       (if (>= word-index len)
           (not (bignum-plus-p bignum))
-          (not (zerop (logand (%bignum-ref bignum word-index)
-                              (ash 1 bit-index))))))))
+          (logbitp bit-index (%bignum-ref bignum word-index))))))
 
 (defun bignum-logcount (bignum)
   (declare (type bignum-type bignum))
index 5de724a..293721b 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.2.8"
+"1.0.2.9"