Commit a727ee64 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2720e9af
...@@ -736,11 +736,13 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) { ...@@ -736,11 +736,13 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
// - need to do the usual scan from root to split index pages. // - need to do the usual scan from root to split index pages.
default: default:
p, pi := t.hitP, t.hitPi p, pi := t.hitP, t.hitPi
if p == nil || p.c <= 2*kx { if p != nil && p.c > 2*kx {
// XXX note on overflow corrects what break
t.overflow(p, dd, pi, i, k, v)
return
} }
// NOTE overflow corrects hit Kmin, Kmax and Pi as needed
t.overflow(p, dd, pi, i, k, v)
return
} }
} }
...@@ -800,7 +802,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) { ...@@ -800,7 +802,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
default: default:
// NOTE overflow corrects hit Kmin, Kmax and Pi as needed // NOTE overflow corrects hit Kmin, Kmax and Pi as needed
// XXX if split
t.overflow(p, x, pi, i, k, v) t.overflow(p, x, pi, i, k, v)
} }
...@@ -929,7 +930,7 @@ func (t *Tree) split(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{} / ...@@ -929,7 +930,7 @@ func (t *Tree) split(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{} /
if i > kd { if i > kd {
t.insert(r, i-kd, k, v) t.insert(r, i-kd, k, v)
t.hitKmin.set(p.x[pi].k) t.hitKmin.set(p.x[pi].k)
t.hitKmax := t.hitPKmax t.hitKmax = t.hitPKmax
if pi+1 < p.c { // k=+∞ @p.c if pi+1 < p.c { // k=+∞ @p.c
t.hitKmax.set(p.x[pi+1].k) t.hitKmax.set(p.x[pi+1].k)
} }
......
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