Jimmy,Jing Lv wrote:
> 2007/7/4, Xiao-Feng Li <xiaofeng.li@gmail.com>:
>> Well, maybe I should read some random number theory, since I think
>> although >>2 removes the meaningless bits in LSB, it introduces two
>> meaningless bits in MSB. If you treat the 32 bit equally when encoding
>> their info into log(num_bucket) bits, the bits in LSB and MSB give you
>> the same effect. Or you assume the lower bits are more significant by
>> default?
>
> Yes, the second hypothesis I made here is that the lower bits are
> more important than higher bits,
How about: the lower bits are *equally as important* as the higher bits
if the hashCode algorithm is producing an even distribution of values.
> we focus on lower bits more than higher bits (though not throw higher
> bits away) however it is imposible for them to be equal in indexing,
> especially in small buckets.
Yes, and of course we keep the full hashCode around too (to use for a
fast check of potential equals() and for rehashing).
> We choose lower bits for most of time hashcodes alter in lower bits.
Why?
> And move meaningless bits to MSB here fits this algorithm
> :)
We just don't consider them when computing the index, so they could be
meaningful or meaningless, we don't care.
Regards,
Tim
|