zzh

zzh

通过hash值计算下标的方式

1. 取余

idx = hash % length;

2. 位运算 (length 最好为 2 的 n 次幂)

idx = hash & (length-1);

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.