in reply to Pure perl Jenkins 32 bit Hash
Are you sure the 32-bit mix4 is correct? Doing low-level unsigned arithmetic can be awkward in perl.
... $a -= $b; $a -= $c; no integer; $a ^= ($c >> 13); use integer; ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pure perl Jenkins 32 bit Hash
by huck (Prior) on Nov 18, 2017 at 02:56 UTC | |
Are you sure the 32-bit mix4 is correct? Guess not
Doing low-level unsigned arithmetic can be awkward in perl. Seems so, this needs more investigation and i dont have a C compiler for that 32bit machine Thanks for the heads up, I will keep looking deeper Added: Re: How to do 'unsigned shift right' in perl? Note that both "<<" and ">>" in Perl are implemented directly using "<<" and ">>" in C. If use integer (see Integer Arithmetic) is in force then signed C integers are used, else unsigned C integers are used. Added2: Wow Ive got the "fix", just like you said, but understanding why it works and "-hash hash3" still doesnt work on 32bit and how mixing IV,UV and possibly NV arithmetic between mix and hash3 is causing the difference hasnt quite gelled yet. I'll be back! Devel::Peek and perlguts will rescue me! | [reply] [d/l] |
|
Re^2: Pure perl Jenkins 32 bit Hash
by huck (Prior) on Nov 18, 2017 at 19:06 UTC | |
Doing low-level unsigned arithmetic can be awkward in perl. yupo ok so i developed an overly debugged version of mix and the revised mix4 and ran it on the 32 bit box
This is mix and the results are very interesting during the first modification of C mix4exp shows (it is best to look at the following using download version without wrap) The Dump calls are Dump($_[C]); Notice that in mix4exp the Dump shows C stays IV, and shows the proper result of mod(32) arithmetic with A and B . But notice how in mixexp the Dump shows that after -=A C has stayed IV, with the proper result, but that after -=B C overflowed the IV creating a NV and when it comes to the shift portion it is an overflow indicator (0x80000000) that gets shifted. Of course everything goes to L in a handbasket after that. Doing low-level unsigned arithmetic can be awkward in perl. yupo | [reply] [d/l] [select] |