List Info

Thread: Re: Nonportable code in C++ support




Re: Nonportable code in C++ support
country flaguser name
United States
2008-02-15 13:14:15
Esben Mose Hansen wrote:
> It wouldn't break. It's a hash function, it's going to
get moduloed with some 
> smallish number anyway. The hash function just need a
reasonable chance to 
> get different results for different pointers, fast. The
latter is the reason 
> why I wouldn't bitshift it with size_t, even though
those bits would likely 
> nearly always be zero.

Isn't this a *really* good reason to strip the last couple
bits? I.e. 
because otherwise with a small table you will *always* get
collisions 
due to the last 2-4 bits always being 0?

Seriously, how long does a bit-shift operation take? It's
measured in 
single-digit /cycles/ after all... It's measurable compared
to the cost 
of calling the hash function, but not compared to much
else.

-- 
Matthew
A pool hall put up a sign in their front window that read:
"Profound 
language prohibited within." I could just imagine some
people discussing 
the meaning of life and being told to take it outside. --
Scott Adams


_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )