diff --git a/pmap.go b/pmap.go index eedef9c..03e0d48 100644 --- a/pmap.go +++ b/pmap.go @@ -95,7 +95,7 @@ func (m *collision) getNode(hash uint32, key Key) interface{} { } for i := range m.leaf { if key == m.leaf[i].k { - return m.leaf[i].v + return m.leaf[i] } } return nil @@ -157,7 +157,7 @@ func insert(n interface{}, shift, hash uint32, key Key, val Value, hashFn hashFu } else if h := hashFn(n.k); h == hash { // collision added = true - return collision{hash, []leaf{{key, val}, n}} + return &collision{hash, []leaf{{key, val}, n}} } else { if h>>shift == hash>>shift { panic("pmap: infinite loop in insert") @@ -196,12 +196,12 @@ func insert(n interface{}, shift, hash uint32, key Key, val Value, hashFn hashFu l = append(l, n.leaf[:i]...) l = append(l, n.leaf[i+1:]...) added = false - return collision{hash, l} + return &collision{hash, l} } } // new collision added = true - return collision{hash, append([]leaf{{key, val}}, n.leaf...)} + return &collision{hash, append([]leaf{{key, val}}, n.leaf...)} default: panic("pmap: unhandled case in insert") }