Skip to content

Commit c2dcb3b

Browse files
authored
Merge pull request #9 from jdz/patch-1
Process bit vector from end instead of reversing
2 parents 2260988 + 6d6204d commit c2dcb3b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/arithmetic.lisp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"Returns the bits of BIT-VECTOR as an integer as the primary value, number of bits as the secondary value.
1111
SLOW!! Consult Hackers-Delight"
1212
(let ((place -1))
13-
(values (reduce #'+ (reverse bit-vector) :key (lambda (digit) (ash digit (incf place))))
13+
(values (reduce #'+ bit-vector
14+
:key (lambda (digit) (ash digit (incf place)))
15+
:from-end t)
1416
(incf place))))
1517

1618
(defun bit-sum (&rest rest)

0 commit comments

Comments
 (0)