Skip to content

Commit

Permalink
Implement suggested change (risky Cons {a;n;tl} -> Cons r)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-pi-sona-lili authored Jan 9, 2024
1 parent 3f14750 commit 5b65108
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Iter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ module MList = struct
| _ ->
match !tail with
| Nil -> ()
| Cons (_ as r) -> r.tl <- !cur
| Cons r -> r.tl <- !cur
in

seq (fun x ->
Expand All @@ -215,11 +215,11 @@ module MList = struct
let n = !chunk_size in
if n < 4096 then chunk_size := 2 * n;
cur := Cons {a=Array.make n x; n = 1; tl = Nil}
| Cons ({a; n; tl} as r) ->
assert (n < Array.length a);
a.(n) <- x;
r.n <- succ n;
if r.n = Array.length a then (
| Cons r ->
assert (r.n < Array.length r.a);
r.a.(r.n) <- x;
r.n <- succ r.n;
if r.n = Array.length r.a then (
replace_tail ();
tail := !cur;
cur := Nil
Expand Down

0 comments on commit 5b65108

Please sign in to comment.