mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-06 01:07:06 +08:00
bugfix:convert the range of k from [1,17] to [1,16]
This commit is contained in:
@@ -58,7 +58,7 @@ func makeSkiplist() *skiplist {
|
|||||||
func randomLevel() int16 {
|
func randomLevel() int16 {
|
||||||
total := uint64(1)<<uint64(maxLevel) - 1
|
total := uint64(1)<<uint64(maxLevel) - 1
|
||||||
k := rand.Uint64() % total
|
k := rand.Uint64() % total
|
||||||
return maxLevel - int16(bits.Len64(k)) + 1
|
return maxLevel - int16(bits.Len64(k+1)) + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (skiplist *skiplist) insert(member string, score float64) *node {
|
func (skiplist *skiplist) insert(member string, score float64) *node {
|
||||||
|
Reference in New Issue
Block a user