on master help sign in
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.

commit4544b39cbcb6e4f086b4976d9b604a5864cb947b authorBryan O'Sullivan <bos@serpentine.com> dateTue 4 Oct 2011, 07:42 (15 years ago) parent829bea1
1 file changed+3−2
Data/Text/Lazy/Search.hs+3−2
Data/Text/Lazy/Search.hs+3−2
@@ -77,9 +77,10 @@ indices needle@(Chunk n ns) _haystack@(Chunk k ks)
7777 go !(g::Int64) !i !msk !skp
7878 | i >= xlast = case xs of
7979 Empty -> (msk .|. swizzle z) :*: skp
80− Chunk y ys -> buildTable y ys g 0 msk skp
81− | otherwise = go (g+1) (i+1) (msk .|. swizzle c) skp'
80+ Chunk y ys -> buildTable y ys g 0 msk' skp'
81+ | otherwise = go (g+1) (i+1) msk' skp'
8282 where c = A.unsafeIndex xarr (xoff+i)
83+ msk' = msk .|. swizzle c
8384 skp' | c == z = nlen - g - 2
8485 | otherwise = skp
8586 xlast = xlen - 1