Commit b1c3915a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d40c9c54
...@@ -216,7 +216,10 @@ loop: ...@@ -216,7 +216,10 @@ loop:
case *d: case *d:
switch op { switch op {
case opGet: case opGet:
panic("TODO") // tried to search for key > max k in x
if !ok && i >= x.c {
i = x.c - 1
}
case opSet: case opSet:
if !ok { if !ok {
......
...@@ -862,6 +862,10 @@ func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists ...@@ -862,6 +862,10 @@ func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists
t.insert(dd, i, k, newV) t.insert(dd, i, k, newV)
} else { } else {
t.hitDi = i t.hitDi = i
// if it was only Get landed past max key - adjust it to valid entry
if t.hitDi >= dd.c {
t.hitDi--
}
} }
return return
...@@ -881,6 +885,10 @@ func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists ...@@ -881,6 +885,10 @@ func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists
t.overflow(p, dd, pi, i, k, newV) t.overflow(p, dd, pi, i, k, newV)
} else { } else {
t.hitDi = i t.hitDi = i
// see about "valid entry" ^^^
if t.hitDi >= dd.c {
t.hitDi--
}
} }
return return
} }
...@@ -937,6 +945,10 @@ func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists ...@@ -937,6 +945,10 @@ func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists
if !written { if !written {
t.hitD, t.hitDi = x, i t.hitD, t.hitDi = x, i
// see about "valid entry" ^^^
if t.hitDi >= x.c {
t.hitDi--
}
break break
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment