Commit 311e0d84 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent edd535de
...@@ -204,14 +204,21 @@ loop: ...@@ -204,14 +204,21 @@ loop:
case *d: case *d:
switch { switch op {
case op == opSet && !ok: case opSet:
bad("key %v not found after set", k) if !ok {
bad("key %v not found after set", k)
}
case op == opDel && ok: case opDel:
bad("key %v found after delete", k) if ok {
bad("key %v found after delete", k)
}
// XXX adjust i to be in range for opDel // delted last element or tried to delete element past max k in x
if i >= x.c {
i = x.c - 1
}
} }
dd = x dd = x
......
...@@ -323,7 +323,11 @@ func (t *Tree) Delete(k interface{} /*K*/) (ok bool) { ...@@ -323,7 +323,11 @@ func (t *Tree) Delete(k interface{} /*K*/) (ok bool) {
switch { switch {
case !ok: case !ok:
dbg("ok'") dbg("ok'")
t.hitDi = i // XXX ok ? (i > h) if i >= dd.c {
// tried to delete element past max k in hitD
i = dd.c - 1
}
t.hitDi = i
return false return false
case dd.c > kd: case dd.c > kd:
......
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