Hi,

On Thu, 10 Sep 2015, François Dumont wrote:

>     Here is a patch to offer an alternative hash policy. This one is 
> using power of 2 number of buckets allowing a faster modulo operation. 
> This is obvious when running the performance test that I have adapted to 
> use this alternative policy. Something between current implementation 
> and the tr1 one, the old std one.
> 
>     Of course with this hash policy the lower bits of the hash code are 
> more important. For pointers it would require to change the std::hash 
> implementation to remove the lower 0 bits like in the patch I proposed 
> some weeks ago.
> 
>     What do you think ?

No comment on if it should be included (except that it seems useful to 
me), but one observation of the patch:

> +    1ul << 31,
> +#if __SIZEOF_LONG__ != 8
> +    1ul << 32
> +#else

This is wrong, 1ul<<32 is zero on a 32bit machine, and is also the 33rd 
entry in that table, when you want only 32.  Like you also (correctly) 
stop with 1ul<<63 for a 64bit machine.


Ciao,
Michael.

Reply via email to