Skip to content

Commit

Permalink
Merge pull request #9 from jdz/patch-1
Browse files Browse the repository at this point in the history
Process bit vector from end instead of reversing
  • Loading branch information
thephoeron authored Oct 2, 2018
2 parents 2260988 + 6d6204d commit c2dcb3b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/arithmetic.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"Returns the bits of BIT-VECTOR as an integer as the primary value, number of bits as the secondary value.
SLOW!! Consult Hackers-Delight"
(let ((place -1))
(values (reduce #'+ (reverse bit-vector) :key (lambda (digit) (ash digit (incf place))))
(values (reduce #'+ bit-vector
:key (lambda (digit) (ash digit (incf place)))
:from-end t)
(incf place))))

(defun bit-sum (&rest rest)
Expand Down

0 comments on commit c2dcb3b

Please sign in to comment.