shithub: gefs

Download patch

ref: 0c0d2c1702d0f9b5e984a7c90308a19a594a8abb
parent: 6419ee410e0f2e6288624e266b7e3d8396b471c6
author: Michael Forney <[email protected]>
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;