Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Hash Collision

Author: David Rasmussen

Date: 03:00:24 12/08/02

Go up one level in this thread


On December 07, 2002 at 13:54:56, Sune Fischer wrote:

>
>Well it's still a good idea to do the test, because you detect a small portion
>when only validating the hash move. Anyway it shouldn't be more than a few lines
>inserted into the hash probe.
>
>#define ChopOff(x) (x&0xffffffffffff0000) // ie try with 48 bits
>
>if (current_key!=draft_key)
>  if (ChopOff(current_key)==ChopOff(draft_key))
>     Collisions++;
>
>

First of all, it should be

#define ChopOff(x) ((x)&0xffffffffffff0000) // ie try with 48 bits

Not using parenthesis on all levels in preprocessor macros, will get you into
trouble sooner og later. Of course, I would never use the preprocessor if I
could avoid it (and I almost always can). In this case, since I am using C++, I
would make a typesafe inline function instead (which is one of the many many
reasons I am using C++ instead of C).

That aside, what do you hope to accomplish by such code? You count how many
times the upper 48 bits of a 64 bit signature are the same for different
signatures. That's not interesting. I use the whole signature for comparison in
my hash entries so the upper 48 bits are not interesting to me. Such a count
just shows how many collisions I _would_ have (at least) if I used 48 bit
signatures instead of 64 bit signatures. I don't.

/David



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.