Skip to content
Browse files

minor tweaks (replace incf with setf, reorder for clauses in loop) to…

… silence SBCL's compiler notes
  • Loading branch information...
1 parent 6311d31 commit b50fac80a61f26d63e31b490465fd0afcda077db @slyrus committed Mar 25, 2011
Showing with 13 additions and 6 deletions.
  1. +13 −6 cluster.lisp
View
19 cluster.lisp
@@ -56,7 +56,10 @@
(declare (type fixnum m))
(setf (aref means m)
(+ (pixel image i j) (aref means m)))
- (incf (aref counts (aref z i j)))))
+ (let* ((cluster (aref z i j))
+ (cluster-count (aref counts cluster)))
+ (setf (aref counts cluster)
+ (logand most-positive-fixnum (1+ cluster-count))))))
(dotimes (q k)
(when (plusp (aref counts q))
(setf (aref means q)
@@ -129,7 +132,10 @@
(+ v1 m1)
(+ v2 m2)
(+ v3 m3)))))
- (incf (aref counts (aref z i j)))))
+ (let* ((cluster (aref z i j))
+ (cluster-count (aref counts cluster)))
+ (setf (aref counts cluster)
+ (logand #xffffffff (1+ cluster-count))))))
(dotimes (q k)
(when (plusp (aref counts q))
(multiple-value-bind (m1 m2 m3)
@@ -143,10 +149,11 @@
(loop for count across counts
for i below k
collect (list count (pixel* means i 0)))))
- (loop for (count mean) in (sort new-means-list #'> :key #'first)
- for i fixnum below k
- do (setf (pixel* means i 0) mean)
- (setf (aref counts i) count))))
+ (loop for i fixnum below k
+ for (count mean) in (sort new-means-list #'> :key #'first)
+ do
+ (setf (pixel* means i 0) mean)
+ (setf (aref counts i) count))))
(assign-to-means ()
(declare (type 8-bit-rgb-image image)
(optimize (speed 3)))

0 comments on commit b50fac8

Please sign in to comment.
Something went wrong with that request. Please try again.