From 92da4299be59838295f83103c79a0c1b8f2e713c Mon Sep 17 00:00:00 2001 From: Daniel Fischer Date: Tue, 25 Oct 2011 02:34:27 +0200 Subject: [PATCH] Fix buildTable On chunk boundaries, the character was not recorded and the global index not incremented, causing issue #10. --- Data/Text/Lazy/Search.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Text/Lazy/Search.hs b/Data/Text/Lazy/Search.hs index e6cfb435..77622188 100644 --- a/Data/Text/Lazy/Search.hs +++ b/Data/Text/Lazy/Search.hs @@ -77,7 +77,7 @@ 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 + Chunk y ys -> buildTable y ys (g+1) 0 (msk .|. swizzle c) skp' | otherwise = go (g+1) (i+1) (msk .|. swizzle c) skp' where c = A.unsafeIndex xarr (xoff+i) skp' | c == z = nlen - fromIntegral g - 2