Zero-Allocation-Hashing icon indicating copy to clipboard operation
Zero-Allocation-Hashing copied to clipboard

Define API for 32 bit valued functions

Open leventov opened this issue 9 years ago • 5 comments

leventov avatar Oct 31 '14 11:10 leventov

Roman, can you provide more details?

peter-lawrey avatar Jul 24 '16 07:07 peter-lawrey

LongHashFunction returns longs as hash results. the idea is to provide something like IntHashFunction which return ints.

leventov avatar Jul 24 '16 12:07 leventov

Could you not do

long h64 = hash64(...);
int h32 = (int) ((h64 >>> 32) | h64);

peter-lawrey avatar Jul 24 '16 14:07 peter-lawrey

@peter-lawrey yes, currently people do this. But this looks like the library's job. In the simplest case IntLongFunction could do exactly this.

leventov avatar Jul 24 '16 14:07 leventov

Should that be

long h64 = hash64(...);
int h32 = (int) ((h64 >>> 32) ^ h64);

I think you want bitwise exclusive OR, not bitwise OR

pjakubik avatar Jul 30 '23 16:07 pjakubik