Subject: | $aa ^ (0x03ffffff & ($a >> 6)) |
Date: | Tue, 03 Jun 2014 21:37:14 +0200 |
To: | bug-Math-Random-ISAAC [...] rt.cpan.org |
From: | Lorenzo <lory.fulgi [...] infinito.it> |
Hi,
ISAAC/PP.pm says to file a bug to explain the 0x03ffffff, so here it is.
Quoting perlop on shift operators, "If use integer (see Integer
Arithmetic) is in force then signed C integers are used, else unsigned C
integers are used"; the _isaac function actually has a "use integer;",
so shifting to the right uses signed shifts, meaning that on 32 bit
machines 0xffffffff>>6 is not 0x03ffffff, it's still 0xffffffff because
the sign is preserved (if you've ever had to do this things in java,
think ">>" vs ">>>").
Just in case you were still interested in 2014 :)