You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-twox-hash/twox-hash-1.6.2-Fix-XXH3-ge...

27 lines
1.1 KiB

From f085fe2e12321dcb5ecbb145ffde5c9c6fccd4aa Mon Sep 17 00:00:00 2001
From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Fri, 4 Mar 2022 15:06:31 +0100
Subject: [PATCH] Fix XXH3 generic fallback
The generic fallback code used on non-Intel platforms seems to
have a bug that makes the computed hashes different from the
SSE and AVX code pathes (and the test cases). This patch makes
the generic path also pass the tests.
---
src/xxh3.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/xxh3.rs b/src/xxh3.rs
index b793a521a..0ffc54189 100644
--- a/src/xxh3.rs
+++ b/src/xxh3.rs
@@ -754,7 +754,7 @@ mod generic {
let data_key1 = key1 ^ in1;
let data_key2 = key2 ^ in2;
acc[i] = acc[i].wrapping_add(mul32_to64(data_key1, data_key1 >> 32));
- acc[i + 1] = acc[i].wrapping_add(mul32_to64(data_key2, data_key2 >> 32));
+ acc[i + 1] = acc[i + 1].wrapping_add(mul32_to64(data_key2, data_key2 >> 32));
if acc_width == AccWidth::Acc128Bits {
acc[i] = acc[i].wrapping_add(in2);