skeeto / hash-prospector

Automated integer hash function discovery
The Unlicense
672 stars 27 forks source link

added bswap #4

Closed Logan007 closed 3 years ago

Logan007 commented 3 years ago

While looking for some changes in another project's hashing function, I came across your page and your blog. Great work!

Actually, I currently am using the prospector to find some maybe unique hashing function… but perhaps, I will just lazily fall-back to your lowbias32() or triple32().

However, I found that the famous endianess-changer (bijective, fast on many platforms) has still been missing in the prospector. So, this pull request adds 32-bit and 64-bit byte-swap as bswap. The C-code output prints out the __builtin intrinsics – I found le64toh(htobe64(x)); to be a less readable alternative.

Digging for gold, it has not brought me any luck yet. But, who knows…

./prospector -p bswap -L -4 | more's output indicate that it is working well, also with -8.

skeeto commented 3 years ago

Good idea, Logan! And cleanly done. I squashed your commits and merged as 4d9ad49.