File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1307,16 +1307,17 @@ splitAt = loop
13071307 loop ! _ Empty = (empty, empty)
13081308 loop n t | n <= 0 = (empty, t)
13091309 loop n (Chunk t@ (T. Text arr off len) ts)
1310+ | n > mx = let (ts', ts'') = loop (n - intToInt64 (T. length t)) ts
1311+ in (Chunk t ts', ts'')
13101312 | m > 0 , m >= len = (Chunk t Empty , ts)
13111313 | m > 0 = let t' = T. Text arr off m
13121314 t'' = T. Text arr (off+ m) (len- m)
13131315 in (Chunk t' Empty , Chunk t'' ts)
13141316 | otherwise = let (ts', ts'') = loop (n + intToInt64 m) ts
13151317 in (Chunk t ts', ts'')
13161318 where
1317- k | n > intToInt64 len = len+ 1
1318- | otherwise = int64ToInt n
1319- m = T. measureOff k t
1319+ mx = intToInt64 P. maxBound
1320+ m = T. measureOff (int64ToInt n) t
13201321
13211322
13221323-- | /O(n)/ 'splitAtWord' @n t@ returns a strict pair whose first
You can’t perform that action at this time.
0 commit comments