Sujet : Re: Good hash for pointers
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 05. Jun 2024, 10:34:50
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240605123450.00003fdb@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Wed, 5 Jun 2024 11:10:24 +0200
Bonita Montero <
Bonita.Montero@gmail.com> wrote:
Am 04.06.2024 um 23:59 schrieb Michael S:
18446744073709551557 is indeed very bad (too close to 2**64).
It doesn't matter how close the prime is to 2 ^ 64 since the
results are chopped.
I have no idea what you are talking about.
18446744073709551557 == -59.
That's a very small number. With factor like that, for typical case of
pointers that are <= 2**40 and
for table size in 1000s or 10,000s, all keys (==pointers) would be
pushed into the same (uppermost) slot of the table with no hashing at
all.
You can run my test bench and see it yourself.
On the other hand, prime in range (2**63..2**64) that does not have too
many bits set or cleared works very well. But majority of non-primes
with the same properties would work very well as well.