remove shift argument from insert

master
magical 2022-01-23 02:59:35 +00:00
parent 9553b9a9e4
commit 6de290647d
1 changed files with 3 additions and 3 deletions

View File

@ -64,7 +64,7 @@ func (p pmap) Get(k Key) (Value, bool) {
func (p pmap) Set(k Key, v Value) Map { func (p pmap) Set(k Key, v Value) Map {
h := p.hash(k) h := p.hash(k)
root, added := insert(p.root, 0, h, k, v, hash) root, added := insert(p.root, h, k, v, hash)
p.root = root p.root = root
if added { if added {
p.len++ p.len++
@ -129,7 +129,7 @@ func newnode(child interface{}, hash, shift uint32) *node {
return n return n
} }
func insert(n interface{}, shift, hash uint32, key Key, val Value, hashFn HashFunc) (newNode interface{}, added bool) { func insert(n interface{}, hash uint32, key Key, val Value, hashFn HashFunc) (newNode interface{}, added bool) {
if n == nil { if n == nil {
return leaf{key, val}, true return leaf{key, val}, true
} }
@ -197,7 +197,7 @@ func insert(n interface{}, shift, hash uint32, key Key, val Value, hashFn HashFu
panic("pmap: unhandled case in insert") panic("pmap: unhandled case in insert")
} }
} }
newNode = _insert(n, shift) newNode = _insert(n, 0)
return return
} }