Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: Perl XS portable uint32_tby tachyon-II (Chaplain) |
on Jun 06, 2008 at 13:33 UTC ( [id://690669]=note: print w/replies, xml ) | Need Help?? |
Hi Rob, Unfortunately most hashing behaviour depends on the idiosyncrcies of overflow wrap and truncation implicit in an (32 bit) int. Consider this case (using a 4 bit "int" on a 4 and 8 bit machine) So after two identical operations the results on 4 vs 8 bit architecture now differ. Essentially by having the spare high order bits we do not lose those bits to the big bit bucket in the sky, so when we right shift they reappear. As a result any algorithm that uses much bitshifting will not work as desired if the int being used is not exacty the design width. Unfortunately you can't use sizeof in a preprocessor directive to do the setup one way on a 32 bit machine and another way on a 64 bit one. Cheers tachyon
In Section
Seekers of Perl Wisdom
|
|