Skip to content

Commit

Permalink
1.0.2.9:
Browse files Browse the repository at this point in the history
	Micro-optimizations to the bignum code: use LOGTEST and LOGBITP
	  where appropriate.
  • Loading branch information
Nathan Froyd committed Feb 5, 2007
1 parent 0cb75ba commit 9e3b2d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/code/bignum.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@
(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)))
Expand Down Expand Up @@ -634,7 +634,7 @@
(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
Expand Down Expand Up @@ -1277,7 +1277,7 @@

(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)
Expand Down Expand Up @@ -1315,8 +1315,7 @@
(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))
Expand Down
2 changes: 1 addition & 1 deletion version.lisp-expr
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 9e3b2d8

Please sign in to comment.