From: stassats <sta...@us...> - 2011-12-08 15:23:03
|
The branch "master" has been updated in SBCL: via 5bb3440a27492813feac0b9730283bb62d4690b8 (commit) from 2c9e9cdf20257c422cd43bd30b89990499bca475 (commit) - Log ----------------------------------------------------------------- commit 5bb3440a27492813feac0b9730283bb62d4690b8 Author: Stas Boukarev <sta...@gm...> Date: Thu Dec 8 19:22:12 2011 +0400 Fix transform for SEARCH on vectors with :form-end t. When from-end is specified, start2 becomes end2 and the other way around, so return star2 or end2 accordingly when testing for an empty subsequence. --- src/compiler/seqtran.lisp | 4 +++- tests/seq.pure.lisp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compiler/seqtran.lisp b/src/compiler/seqtran.lisp index f87bd78..5181c06 100644 --- a/src/compiler/seqtran.lisp +++ b/src/compiler/seqtran.lisp @@ -1088,7 +1088,9 @@ (unless (<= start2 end2 len2) (oops pattern start2 end2)))) (when (= end1 start1) - (return-from search start2)) + (return-from search (if from-end + end2 + start2))) (do (,(if from-end '(index2 (- end2 (- end1 start1)) (1- index2)) '(index2 start2 (1+ index2)))) diff --git a/tests/seq.pure.lisp b/tests/seq.pure.lisp index d6aa497..ded374f 100644 --- a/tests/seq.pure.lisp +++ b/tests/seq.pure.lisp @@ -298,4 +298,8 @@ (assert (eql 2 (funcall (lambda () (declare (optimize speed)) - (search #(1) #(1 1) :start1 1 :start2 2)))))) + (search #(1) #(1 1) :start1 1 :start2 2))))) + (assert (eql 2 + (funcall (lambda () + (declare (optimize speed)) + (search #() #(1 1) :from-end t)))))) ----------------------------------------------------------------------- hooks/post-receive -- SBCL |