shithub: gefs

Download patch

ref: 23f1e3e4b945aae087aa98825a67ea64a92cf17a
parent: 91dbb8d0b0f3b77513bc33334465af796c40aa1e
author: Michael Forney <mforney@mforney.org>
date: Thu Feb 3 05:54:14 EST 2022

hash: use logical right shift in ihash

This aligns ihash with the SplittableRandom/SplitMix64 function,
which is defined using logical shifts.

[0] https://xorshift.di.unimi.it/splitmix64.c

--- a/fns.h
+++ b/fns.h
@@ -30,7 +30,7 @@
 void	reclaimblk(Bptr);
 ushort	blkfill(Blk*);
 uvlong	blkhash(Blk*);
-u32int	ihash(vlong);
+u32int	ihash(uvlong);
 void	finalize(Blk*);
 Tree*	newsnap(Tree*);
 char*	freesnap(Tree*, Tree*);
--- a/hash.c
+++ b/hash.c
@@ -109,7 +109,7 @@
 }
 
 u32int
-ihash(vlong x)
+ihash(uvlong x)
 {
     x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ULL;
     x = (x ^ (x >> 27)) * 0x94d049bb133111ebULL;