Fix buildTable
On chunk boundaries, the character was not recorded and the global index not
incremented, causing issue #10.
commit92da4299be59838295f83103c79a0c1b8f2e713c
authorDaniel Fischer <daniel.is.fischer@googlemail.com>
dateTue 25 Oct 2011, 02:34 (15 years ago)
parent73d7013
Data/Text/Lazy/Search.hs+1−1
@@ -77,7 +77,7 @@ 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
80+ Chunk y ys -> buildTable y ys (g+1) 0 (msk .|. swizzle c) skp'
8181 | otherwise = go (g+1) (i+1) (msk .|. swizzle c) skp'
8282 where c = A.unsafeIndex xarr (xoff+i)
8383 skp' | c == z = nlen - fromIntegral g - 2