Hacker News new | ask | show | jobs
by codahale 6228 days ago
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.

1 comments

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.