Skip to content
Browse files

Fix a corner case in lazy text search.

On a chunk boundary, we were not passing the correct mask and skip values
along to the function that would process the next chunk.
  • Loading branch information...
1 parent 829bea1 commit 4544b39cbcb6e4f086b4976d9b604a5864cb947b @bos committed Oct 4, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 Data/Text/Lazy/Search.hs
View
5 Data/Text/Lazy/Search.hs
@@ -77,9 +77,10 @@ indices needle@(Chunk n ns) _haystack@(Chunk k ks)
go !(g::Int64) !i !msk !skp
| i >= xlast = case xs of
Empty -> (msk .|. swizzle z) :*: skp
- Chunk y ys -> buildTable y ys g 0 msk skp
- | otherwise = go (g+1) (i+1) (msk .|. swizzle c) skp'
+ Chunk y ys -> buildTable y ys g 0 msk' skp'
+ | otherwise = go (g+1) (i+1) msk' skp'
where c = A.unsafeIndex xarr (xoff+i)
+ msk' = msk .|. swizzle c
skp' | c == z = nlen - g - 2
| otherwise = skp
xlast = xlen - 1

0 comments on commit 4544b39

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