mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-07 11:45:41 -05:00
optimize Vec.{get,set}
This commit is contained in:
parent
6f54604dc9
commit
66707b58fc
1 changed files with 2 additions and 2 deletions
|
|
@ -95,14 +95,14 @@ let last t =
|
|||
|
||||
let get t i =
|
||||
if i < 0 || i >= t.sz then invalid_arg "vec.get";
|
||||
Array.get t.data i
|
||||
Array.unsafe_get t.data i
|
||||
|
||||
let set t i v =
|
||||
if i < 0 || i > t.sz then invalid_arg "vec.set";
|
||||
if i = t.sz then
|
||||
push t v
|
||||
else
|
||||
Array.set t.data i v
|
||||
Array.unsafe_set t.data i v
|
||||
|
||||
let copy t =
|
||||
let data = Array.copy t.data in
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue