Add function header and return to mixing-function derivation

Eric Coissac committed 2026-09-12 11:19:13 +02:00
1 parent 98af17f50a
commit 3a2b4b467d
1 file changed
+1 -1
+1 -1
@@ -20,7 +20,7 @@ The hash function is a 64-bit mixing function (splitmix64-style finalizer) appli
$$H(x) = \text{mix64}(x \oplus s), \quad s = \lfloor 2^{64}/\varphi \rfloor = \texttt{0x9e3779b97f4a7c15}$$ $$H(x) = \text{mix64}(x \oplus s), \quad s = \lfloor 2^{64}/\varphi \rfloor = \texttt{0x9e3779b97f4a7c15}$$
$$\begin{aligned} x &\gets x \oplus \texttt{0x9e3779b97f4a7c15} \\ x &\gets x \oplus (x \gg 30) \\ x &\gets x \times \texttt{0xbf58476d1ce4e5b9} \\ x &\gets x \oplus (x \gg 27) \\ x &\gets x \times \texttt{0x94d049bb133111eb} \\ x &\gets x \oplus (x \gg 31) \end{aligned}$$ $$\begin{aligned} H(x) &: \\ x &\gets& x \oplus \texttt{0x9e3779b97f4a7c15} \\ x &\gets& x \oplus (x \gg 30) \\ x &\gets& x \times \texttt{0xbf58476d1ce4e5b9} \\ x &\gets& x \oplus (x \gg 27) \\ x &\gets& x \times \texttt{0x94d049bb133111eb} \\ &\text{return}& x \end{aligned}$$
The XOR seed avoids the finalizer's fixed point at 0 ($\text{mix64}(0) = 0$), which would otherwise make an all-A m-mer (canonical value 0) win every window comparison. The XOR seed avoids the finalizer's fixed point at 0 ($\text{mix64}(0) = 0$), which would otherwise make an all-A m-mer (canonical value 0) win every window comparison.