@@ -58,6 +58,8 @@ indices _needle@(Text narr noff nlen) _haystack@(Text harr hoff hlen)
5858 z = nindex nlast
5959 nindex k = A.unsafeIndex narr (noff+k)
6060 hindex k = A.unsafeIndex harr (hoff+k)
61+ hindex' k | k == hlen = 0
62+ | otherwise = A.unsafeIndex harr (hoff+k)
6163 (mask :: Word64) :*: skip = buildTable 0 0 (nlen-2)
6264 buildTable !i !msk !skp
6365 | i >= nlast = (msk .|. swizzle z) :*: skp
@@ -78,7 +80,7 @@ indices _needle@(Text narr noff nlen) _haystack@(Text harr hoff hlen)
7880 delta | nextInPattern = nlen + 1
7981 | c == z = skip + 1
8082 | otherwise = 1
81− nextInPattern = mask .&. swizzle (hindex (i+nlen)) == 0
83+ nextInPattern = mask .&. swizzle (hindex' (i+nlen)) == 0
8284 scanOne c = loop 0
8385 where loop !i | i >= hlen = []
8486 | hindex i == c = i : loop (i+1)