Commits

Bryan O'Sullivan  committed 280e256

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.

  • Participants
  • Parent commits d5e7625

Comments (0)

Files changed (1)

File Data/Text/Lazy/Search.hs

         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