Skip to content

Commit

Permalink
Cover spesh bug with bit shift ops
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed May 20, 2017
1 parent b5b975b commit c1d6211
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion S03-operators/bit.t
Expand Up @@ -4,7 +4,7 @@ use Test;

# Mostly copied from Perl 5.8.4 s t/op/bop.t

plan 39;
plan 40;

# test the bit operators '&', '|', '^', '+<', and '+>'

Expand Down Expand Up @@ -156,4 +156,16 @@ subtest '+> bit shift' => {
}
}


# RT#131306
subtest 'combination of bit ops in loop keeps giving good result' => {
plan 2;

sub rotr(uint32 $n, uint32 $b) { $n +> $b +| $n +< (32 - $b) };
my $first = rotr 1652322944, 18;
my $iterated; for ^2000 { $iterated = rotr 1652322944, 18 };
is-deeply $first, 27071659120799, 'first iteration';
is-deeply $iterated, 27071659120799, '2000th iteration';
}

# vim: ft=perl6

0 comments on commit c1d6211

Please sign in to comment.