From nobody Thu Nov 6 10:38:32 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540489833196370.03493497671934; Thu, 25 Oct 2018 10:50:33 -0700 (PDT) Received: from localhost ([::1]:56153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFjlw-0000q0-EG for importer@patchew.org; Thu, 25 Oct 2018 13:50:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFjKm-0006hj-D5 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:22:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFjKJ-00007y-24 for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:21:44 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:58607) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFjKH-0008QE-5R for qemu-devel@nongnu.org; Thu, 25 Oct 2018 13:21:41 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1255E2217B; Thu, 25 Oct 2018 13:21:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Oct 2018 13:21:10 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id A72FDE455F; Thu, 25 Oct 2018 13:21:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=2UHt0Q44vKeSkx7tBqripzHNqohH5jICgeUlXxutG3s=; b=Vt6su JWNsQyxopkC/4V0UiqSJb0vjkHmxLip7RQH/u04rBBA+Z1NeaXIu3I6aYPCNtQ1r eSUOSHjhXGJwcQSf5HSHHHjArT5YNAWLvTztZR5iBqvVLOSdI+UKNiYbmXhAdOAZ YxnzyKX6X3ziv+nmYx3yaU6zv7dHmyXwpC1s3U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=2UHt0Q44vKeSkx7tBqripzHNqohH5 jICgeUlXxutG3s=; b=mDSQBXMWp+hZrwHUqTh2JDHUz7Qi2O/7l0Z8cpphmTGRq aDphaZyzIE8PGtVb8zO1d87eDTPMyq1NrRsrSIKodNQQZemXBxrcLLKf5J6B5D1v 6p4Z7es3Du3qS8n82+/Wy45R8YKGckL3wu1Oa+eiCoIRJCliuK9jXGEhy6QQbwbb FMKoKjZ5UhcqyUz70GiuVhrQW4EphkeP70F7OWVbzoAPXYB01qlmk5Ef7dDqZwun sdmKgZe89cay+Srpyh2FNm7dD0k1fQldTNR1FrahSOc1o7kqmYjNag9ypMwnU32A +zuOOyeMEHKNnU6SEsPk+9mgmivsI+lx2r0WGr+Tw== X-ME-Sender: X-ME-Proxy: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 13:20:22 -0400 Message-Id: <20181025172057.20414-14-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025172057.20414-1-cota@braap.org> References: <20181025172057.20414-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [RFC 13/48] xxhash: add qemu_xxhash8 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Pavel Dovgalyuk , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It will be used for TB hashing soon. Signed-off-by: Emilio G. Cota --- include/qemu/xxhash.h | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/include/qemu/xxhash.h b/include/qemu/xxhash.h index fe35dde328..450427eeaa 100644 --- a/include/qemu/xxhash.h +++ b/include/qemu/xxhash.h @@ -49,7 +49,8 @@ * contiguous in memory. */ static inline uint32_t -qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) +qemu_xxhash8(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g, + uint32_t h) { uint32_t v1 =3D QEMU_XXHASH_SEED + PRIME32_1 + PRIME32_2; uint32_t v2 =3D QEMU_XXHASH_SEED + PRIME32_2; @@ -77,17 +78,24 @@ qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint= 32_t f, uint32_t g) v4 =3D rol32(v4, 13); v4 *=3D PRIME32_1; =20 - h32 =3D rol32(v1, 1) + rol32(v2, 7) + rol32(v3, 12) + rol32(v4, 18); - h32 +=3D 28; + v1 +=3D e * PRIME32_2; + v1 =3D rol32(v1, 13); + v1 *=3D PRIME32_1; =20 - h32 +=3D e * PRIME32_3; - h32 =3D rol32(h32, 17) * PRIME32_4; + v2 +=3D f * PRIME32_2; + v2 =3D rol32(v2, 13); + v2 *=3D PRIME32_1; + + v3 +=3D g * PRIME32_2; + v3 =3D rol32(v3, 13); + v3 *=3D PRIME32_1; =20 - h32 +=3D f * PRIME32_3; - h32 =3D rol32(h32, 17) * PRIME32_4; + v4 +=3D h * PRIME32_2; + v4 =3D rol32(v4, 13); + v4 *=3D PRIME32_1; =20 - h32 +=3D g * PRIME32_3; - h32 =3D rol32(h32, 17) * PRIME32_4; + h32 =3D rol32(v1, 1) + rol32(v2, 7) + rol32(v3, 12) + rol32(v4, 18); + h32 +=3D 32; =20 h32 ^=3D h32 >> 15; h32 *=3D PRIME32_2; @@ -100,23 +108,29 @@ qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, ui= nt32_t f, uint32_t g) =20 static inline uint32_t qemu_xxhash2(uint64_t ab) { - return qemu_xxhash7(ab, 0, 0, 0, 0); + return qemu_xxhash8(ab, 0, 0, 0, 0, 0); } =20 static inline uint32_t qemu_xxhash4(uint64_t ab, uint64_t cd) { - return qemu_xxhash7(ab, cd, 0, 0, 0); + return qemu_xxhash8(ab, cd, 0, 0, 0, 0); } =20 static inline uint32_t qemu_xxhash5(uint64_t ab, uint64_t cd, uint32_t e) { - return qemu_xxhash7(ab, cd, e, 0, 0); + return qemu_xxhash8(ab, cd, e, 0, 0, 0); } =20 static inline uint32_t qemu_xxhash6(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f) { - return qemu_xxhash7(ab, cd, e, f, 0); + return qemu_xxhash8(ab, cd, e, f, 0, 0); +} + +static inline uint32_t qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, + uint32_t f, uint32_t g) +{ + return qemu_xxhash8(ab, cd, e, f, g, 0); } =20 #endif /* QEMU_XXHASH_H */ --=20 2.17.1