c = 97; hash = 61, masked hash = 61 c = 99; hash = 611842, masked hash = 611842 c = 99; hash = 613026f8a1, masked hash = 3026f8a1 c = 101; hash = 3032d2383004, masked hash = d2383004 c = 112; hash = d26bebd7d16c, masked hash = ebd7d16c c = 116; hash = ec11db888a08, masked hash = db888a08
(where the hashes are in hexadecimal, and c in decimal).
I'm not sure if that's the right explanation, but maybe the multiplication of a large number with 2**16 causes an automatic upgraded to floating point numbers on your (32bit) platform.
You can verify this assumption by using Devel::Peek, and Dump the variable $hash after each iteration. It prints (PADMY,IOK,pIOK), and if my guess is right, it will print (PADMY,NOK,pNOK) on your platform.
You could try to avoid that by using strings, and bit shifts instead of multiplications. But I'm sure other monks have more experience with bit manipulation magic than I have. Another (but probably inefficient) solution is to use bigint.
In reply to Re: Bitwise & stopped working?
by moritz
in thread Bitwise & stopped working?
by Krokus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |