mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2026-01-28 11:54:51 -05:00
CCVector.insert: check if there's a need to blit
Co-authored-by: Simon Cruanes <simon.cruanes.2007@m4x.org>
This commit is contained in:
parent
9bb280e353
commit
408c14fac7
1 changed files with 1 additions and 1 deletions
|
|
@ -351,7 +351,7 @@ let insert v i x =
|
||||||
if v.size = Array.length v.vec
|
if v.size = Array.length v.vec
|
||||||
then grow_with_ v ~filler:x;
|
then grow_with_ v ~filler:x;
|
||||||
(* Shift the following elements, then put the element at i *)
|
(* Shift the following elements, then put the element at i *)
|
||||||
Array.blit v.vec i v.vec (i+1) (v.size - i);
|
if i < v.size then Array.blit v.vec i v.vec (i+1) (v.size - i);
|
||||||
v.vec.(i) <- x;
|
v.vec.(i) <- x;
|
||||||
v.size <- v.size + 1
|
v.size <- v.size + 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue