|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-03-13 10:57:08
Dave Harris wrote:
> My impression is that the proposed implementation of
> hash_combine: seed ^= hash_value(v) + (seed << 6) + (seed >> 2);
>
> was designed to combine 8-bit character values; do we have any
> evidence it also performs well to combine 32-bit values?
(seed << 6) + (seed >> 2) does "neatly" expand an 8 bit value into a 14 bit
one, but the seed is not necessarily an 8 bit value.
Think of the above as seed ^= hv + seed * 64.25.
But no, we don't have hard data on how it performs on 32 bit values.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk