I have no clue why the values differs from the 5th element on.
You are using a 64-bit perl, (or possibly a 32-bit Perl with 64-bit IVs enabled), which means that your attempts to reproduce the results from the C code which uses 32-bit integers isn't working.
The type of bit-wise math in the C code relies heavily on the implicit mod 2**32 of intermediate results to work.
For a way to 'fix' it, see Re: emulate 32-bit on perl 64.
In reply to Re^3: C code translation to Perl
by BrowserUk
in thread C code translation to Perl
by bottch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |