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:
Yotam Barnoy 2022-02-21 18:50:19 +02:00 committed by GitHub
parent 9bb280e353
commit 408c14fac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -351,7 +351,7 @@ let insert v i x =
if v.size = Array.length v.vec
then grow_with_ v ~filler:x;
(* 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.size <- v.size + 1