Subject: | Bug with <<= and/or |= |
The following code produces what seems to be an internally broken Math::UInt128 object:
use strict;
use warnings;
use integer;
use feature 'say';
use Math::Int128 qw( uint128 );
my $int = uint128(0);
for my $n ( 0, 0, 255, 4294967295 ) {
$int <<= 32;
$int |= $n;
}
# This will either blow up or just give the wrong number
say $int;
But this code works:
use strict;
use warnings;
use integer;
use feature 'say';
use Math::Int128 qw( uint128 );
my $int = uint128(0);
for my $n ( 0, 0, 255, 4294967295 ) {
$int = ( $int << 32 ) | $n;
}
say $int;
It seems like there's some sort of bug in "<<=" and/or "|=".