Commit c72e341b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8332deee
...@@ -122,7 +122,7 @@ type ( ...@@ -122,7 +122,7 @@ type (
} }
xkey struct { // key + whether value is present at all xkey struct { // key + whether value is present at all
k interface {} /*K*/ k interface{} /*K*/
kset bool // if not set - k not present kset bool // if not set - k not present
} }
) )
...@@ -532,8 +532,7 @@ func (t *Tree) hitFind(k interface{} /*K*/) (i int, ok bool) { ...@@ -532,8 +532,7 @@ func (t *Tree) hitFind(k interface{} /*K*/) (i int, ok bool) {
return -1, false return -1, false
} }
return t.find2(hit, k, i+1, hit.c - 1) return t.find2(hit, k, i+1, hit.c-1)
case cmp < 0: case cmp < 0:
if t.hitKmin.kset && t.cmp(k, t.hitKmin.k) < 0 { if t.hitKmin.kset && t.cmp(k, t.hitKmin.k) < 0 {
...@@ -544,7 +543,7 @@ func (t *Tree) hitFind(k interface{} /*K*/) (i int, ok bool) { ...@@ -544,7 +543,7 @@ func (t *Tree) hitFind(k interface{} /*K*/) (i int, ok bool) {
return t.find2(hit, k, 0, i) return t.find2(hit, k, 0, i)
default: default:
return i, true; return i, true
} }
} }
...@@ -644,7 +643,7 @@ func (t *Tree) overflow(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{ ...@@ -644,7 +643,7 @@ func (t *Tree) overflow(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{
t.hitKmin.set(k) t.hitKmin.set(k)
t.hitKmax = t.hitPKmax t.hitKmax = t.hitPKmax
if pi + 1 < p.c { // means < ∞ if pi+1 < p.c { // means < ∞
t.hitKmax.set(p.x[pi+1].k) t.hitKmax.set(p.x[pi+1].k)
} }
t.hitPi = pi + 1 t.hitPi = pi + 1
...@@ -715,7 +714,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) { ...@@ -715,7 +714,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
// dbg("--- POST\n%s\n====\n", t.dump()) // dbg("--- POST\n%s\n====\n", t.dump())
//}() //}()
// check if we can do the update nearby previous change // check if we can do the update nearby previous change
i, ok := t.hitFind(k) i, ok := t.hitFind(k)
if i >= 0 { if i >= 0 {
...@@ -784,7 +782,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) { ...@@ -784,7 +782,6 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
t.hitKmax.set(p.x[pi].k) t.hitKmax.set(p.x[pi].k)
} }
case *d: case *d:
// data page found - perform the update // data page found - perform the update
t.hitP = p t.hitP = p
...@@ -928,7 +925,7 @@ func (t *Tree) split(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{} / ...@@ -928,7 +925,7 @@ func (t *Tree) split(p *x, q *d, pi, i int, k interface{} /*K*/, v interface{} /
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)
kmax := t.hitPKmax kmax := t.hitPKmax
if pi + 1 < p.c { if pi+1 < p.c {
kmax.set(p.x[pi+1].k) kmax.set(p.x[pi+1].k)
} }
t.hitKmax = kmax t.hitKmax = kmax
...@@ -963,7 +960,7 @@ func (t *Tree) splitX(p *x, q *x, pi int, i int) (*x, int) { ...@@ -963,7 +960,7 @@ func (t *Tree) splitX(p *x, q *x, pi int, i int) (*x, int) {
i -= kx + 1 i -= kx + 1
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 { // means < ∞ if pi+1 < p.c { // means < ∞
t.hitKmax.set(p.x[pi+1].k) t.hitKmax.set(p.x[pi+1].k)
} }
} else { } else {
......
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