Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hopefully reduce number of re-allocations
  • Loading branch information
lizmat committed Mar 16, 2015
1 parent 88cc986 commit 8d193d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/native_array.pm
Expand Up @@ -32,14 +32,14 @@ class array is Iterable is repr('VMArray') {
}

multi method STORE(array:D: $value) {
nqp::setelems(self, 0);
nqp::setelems(self, 1);
nqp::bindpos_i(self, 0, nqp::unbox_i($value));
self
}
multi method STORE(array:D: @values) {
nqp::setelems(self, 0);
my int $i = 0;
my int $n = @values.elems;
nqp::setelems(self, $n);
while $i < $n {
nqp::bindpos_i(self, $i, nqp::unbox_i(@values.AT-POS($i)));
$i = $i + 1;
Expand Down Expand Up @@ -202,14 +202,14 @@ class array is Iterable is repr('VMArray') {
}

multi method STORE(array:D: $value) {
nqp::setelems(self, 0);
nqp::setelems(self, 1);
nqp::bindpos_n(self, 0, nqp::unbox_n($value));
self
}
multi method STORE(array:D: @values) {
nqp::setelems(self, 0);
my int $i = 0;
my int $n = @values.elems;
nqp::setelems(self, $n);
while $i < $n {
nqp::bindpos_n(self, $i, nqp::unbox_n(@values.AT-POS($i)));
$i = $i + 1;
Expand Down

0 comments on commit 8d193d8

Please sign in to comment.