All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drop xen/hash.h
@ 2020-10-14  7:04 Jan Beulich
  2020-10-14  7:23 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2020-10-14  7:04 UTC (permalink / raw)
  To: xen-devel
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall, Wei Liu,
	Stefano Stabellini

It has no users and hasn't been touched in 10 years.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/xen/hash.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _XEN_HASH_H
-#define _XEN_HASH_H
-/* Fast hashing routine for a long.
-   (C) 2002 William Lee Irwin III, IBM */
-
-/*
- * Knuth recommends primes in approximately golden ratio to the maximum
- * integer representable by a machine word for multiplicative hashing.
- * Chuck Lever verified the effectiveness of this technique:
- * http://www.citi.umich.edu/techreports/reports/citi-tr-00-1.pdf
- *
- * These primes are chosen to be bit-sparse, that is operations on
- * them can use shifts and additions instead of multiplications for
- * machines where multiplications are slow.
- */
-#if BITS_PER_LONG == 32
-/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
-#define GOLDEN_RATIO_PRIME 0x9e370001UL
-#elif BITS_PER_LONG == 64
-/*  2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */
-#define GOLDEN_RATIO_PRIME 0x9e37fffffffc0001UL
-#else
-#error Define GOLDEN_RATIO_PRIME for your wordsize.
-#endif
-
-static inline unsigned long hash_long(unsigned long val, unsigned int bits)
-{
-    unsigned long hash = val;
-
-#if BITS_PER_LONG == 64
-    /*  Sigh, gcc can't optimise this alone like it does for 32 bits. */
-    unsigned long n = hash;
-    n <<= 18;
-    hash -= n;
-    n <<= 33;
-    hash -= n;
-    n <<= 3;
-    hash += n;
-    n <<= 3;
-    hash -= n;
-    n <<= 4;
-    hash += n;
-    n <<= 2;
-    hash += n;
-#else
-    /* On some cpus multiply is faster, on others gcc will do shifts */
-    hash *= GOLDEN_RATIO_PRIME;
-#endif
-
-    /* High bits are more random, so use them. */
-    return hash >> (BITS_PER_LONG - bits);
-}
- 
-static inline unsigned long hash_ptr(void *ptr, unsigned int bits)
-{
-    return hash_long((unsigned long)ptr, bits);
-}
-#endif /* _XEN_HASH_H */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drop xen/hash.h
  2020-10-14  7:04 [PATCH] drop xen/hash.h Jan Beulich
@ 2020-10-14  7:23 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2020-10-14  7:23 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: George Dunlap, Ian Jackson, Julien Grall, Wei Liu, Stefano Stabellini

On 14/10/2020 08:04, Jan Beulich wrote:
> It has no users and hasn't been touched in 10 years.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-14  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  7:04 [PATCH] drop xen/hash.h Jan Beulich
2020-10-14  7:23 ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.