Hacker News new | ask | show | jobs
by jmhodges 6228 days ago
If someone manages to port the 64-bit version to Java (which probably requires some JNI or JNA work), I would be very happy.
1 comments

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.

Sorry, not 64-bit integers but you get my drift.