Skip to content

Commit

Permalink
optimize Vec.{get,set}
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jul 29, 2016
1 parent 6f54604 commit 66707b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/vec.ml
Expand Up @@ -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
Expand Down

0 comments on commit 66707b5

Please sign in to comment.