mirror of
https://github.com/c-cube/sidekick.git
synced 2026-05-05 08:54:24 -04:00
Vec: fix bound check error
This commit is contained in:
parent
6c8d6840f8
commit
fcbaaae81d
1 changed files with 3 additions and 2 deletions
|
|
@ -73,11 +73,12 @@ let[@inline] get t i =
|
|||
Array.unsafe_get t.data i
|
||||
|
||||
let[@inline] set t i v =
|
||||
if i < 0 || i > t.sz then invalid_arg "vec.set";
|
||||
if i = t.sz then
|
||||
push t v
|
||||
else
|
||||
else if i >= 0 && i < t.sz then
|
||||
Array.unsafe_set t.data i v
|
||||
else
|
||||
invalid_arg "vec.set"
|
||||
|
||||
let[@inline] fast_remove t i =
|
||||
assert (i >= 0 && i < t.sz);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue