about hash
Wang Shaofu
wsffree at hotmail.com
Mon Dec 30 21:14:47 PST 2002
Hi
Looking for help!
hash_t HashKey::HashBytes(const void* bytes, int size) const
{
const unsigned char* cp = (const unsigned char*) bytes;
hash_t h = 0;//unsigned int
for ( int i = 0; i < size; ++i )
// Overflow is okay here.
h = (h >> 31) + (h << 1) + cp[i];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This arithmetic make
sure there is no collision????
return h;
}
Have a nice day!
Ciao
Cloud
_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
More information about the Bro
mailing list