I just ported it to Java. It took me five minutes.
It's 40 lines of C++, most of which are of the `k *= m;` variety. You literally paste in the C++, fix the type declarations, and replace the point increment looping with standard indexed array iteration. Remember to replace `const` with `final` and you're done.
Using JNI for a high-speed hash function makes only slightly more sense than putting a SOAP interface on it.
Yes, and those "k = m" lines are the problem! Those assume unsigned* types! And 64-bit integers! Those multiplications and other operations are all wrong!
You didn't port this to Java, you ported a broken algorithm to Java. Way to go, though.
I VERY much dislike such webpages where there is no information what it is. Stop assuming some knowledge and start of the webpage with a two line description of what the project is.
It's a hash container, right? I do have a use for it, but it took some serious investigation to find out anything about it. The poster you replied to was spot on.
I doubt the Pentium 4 had no barrel shifter, as its shift instructions have single-cycle latency. It does seem, however, that the Prescott can do rotate instructions in one cycle while the Northwood took 4 (thanks, Mubench!).
10 comments
[ 5.1 ms ] story [ 33.9 ms ] threadIt's 40 lines of C++, most of which are of the `k *= m;` variety. You literally paste in the C++, fix the type declarations, and replace the point increment looping with standard indexed array iteration. Remember to replace `const` with `final` and you're done.
Using JNI for a high-speed hash function makes only slightly more sense than putting a SOAP interface on it.
You didn't port this to Java, you ported a broken algorithm to Java. Way to go, though.
Funnily enough, this page http://answers.google.com/answers/threadview?id=388350 says that in 1986 both the i386 and 68030 came with one, but it was missing from the Pentium 4.