Skip to content

Commit

Permalink
Use --/++$i instead of $i = nqp::add/sub_i($i,1)
Browse files Browse the repository at this point in the history
The Iterator role
  • Loading branch information
lizmat committed Feb 16, 2022
1 parent 2bf8466 commit a6019d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core.c/Iterator.pm6
Expand Up @@ -29,7 +29,7 @@ my role Iterator {
my int $todo = nqp::add_i($n,1);

nqp::until( # doesn't sink
nqp::not_i($todo = nqp::sub_i($todo,1))
nqp::not_i(--$todo)
|| nqp::eqaddr((my $pulled := self.pull-one),IterationEnd),
target.push($pulled) # don't .sink $pulled here, it can be a Seq
);
Expand Down Expand Up @@ -74,7 +74,7 @@ my role Iterator {
method skip-at-least(int $toskip) {
my int $left = $toskip;
nqp::while(
nqp::isge_i(($left = nqp::sub_i($left,1)),0) && self.skip-one,
nqp::isge_i(--$left,0) && self.skip-one,
nqp::null
);
nqp::islt_i($left,0)
Expand Down

0 comments on commit a6019d5

Please sign in to comment.