diff mbox series

[10/10] xxhash: remove qemu_xxhash7

Message ID 20230420150009.1675181-11-alex.bennee@linaro.org
State Superseded
Headers show
Series tracing: remove dynamic vcpu state | expand

Commit Message

Alex Bennée April 20, 2023, 3 p.m. UTC
Now we no longer have users for qemu_xxhash7 we can drop an additional
multiply and rol and make qemu_xxhash6 the implementation. Adjust the
smaller hash functions accordingly.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 include/qemu/xxhash.h | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Comments

Philippe Mathieu-Daudé April 21, 2023, 6:53 a.m. UTC | #1
On 20/4/23 17:00, Alex Bennée wrote:
> Now we no longer have users for qemu_xxhash7 we can drop an additional
> multiply and rol and make qemu_xxhash6 the implementation. Adjust the
> smaller hash functions accordingly.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   include/qemu/xxhash.h | 17 ++++-------------
>   1 file changed, 4 insertions(+), 13 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/include/qemu/xxhash.h b/include/qemu/xxhash.h
index c2dcccadbf..bab7d4ca09 100644
--- a/include/qemu/xxhash.h
+++ b/include/qemu/xxhash.h
@@ -49,7 +49,7 @@ 
  * 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_xxhash6(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f)
 {
     uint32_t v1 = QEMU_XXHASH_SEED + PRIME32_1 + PRIME32_2;
     uint32_t v2 = QEMU_XXHASH_SEED + PRIME32_2;
@@ -86,9 +86,6 @@  qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g)
     h32 += f * PRIME32_3;
     h32  = rol32(h32, 17) * PRIME32_4;
 
-    h32 += g * PRIME32_3;
-    h32  = rol32(h32, 17) * PRIME32_4;
-
     h32 ^= h32 >> 15;
     h32 *= PRIME32_2;
     h32 ^= h32 >> 13;
@@ -100,23 +97,17 @@  qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g)
 
 static inline uint32_t qemu_xxhash2(uint64_t ab)
 {
-    return qemu_xxhash7(ab, 0, 0, 0, 0);
+    return qemu_xxhash6(ab, 0, 0, 0);
 }
 
 static inline uint32_t qemu_xxhash4(uint64_t ab, uint64_t cd)
 {
-    return qemu_xxhash7(ab, cd, 0, 0, 0);
+    return qemu_xxhash6(ab, cd, 0, 0);
 }
 
 static inline uint32_t qemu_xxhash5(uint64_t ab, uint64_t cd, uint32_t e)
 {
-    return qemu_xxhash7(ab, cd, e, 0, 0);
-}
-
-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_xxhash6(ab, cd, e, 0);
 }
 
 /*