code: func (t *Tree) Set(k int64, v *primitive) {
  	//dbg("--- PRE Set(%v, %v)\n%s", k, v, t.dump())
  	//defer func() {
  	//	dbg("--- POST\n%s\n====\n", t.dump())
  	//}()
  
  	pi := -1
  	var p *x
  	q := t.r
  	if q == nil {
  		z := t.insert(btDPool.Get().(*d), 0, k, v)
  		t.r, t.first, t.last = z, z, z
  		return
  	}
  
  	for {
  		i, ok := t.find(q, k)
  		if ok {
  			switch x := q.(type) {
  			case *x:
  				if x.c > 2*kx {
  					x, i = t.splitX(p, x, pi, i)
  				}
  				pi = i + 1
  				p = x
  				q = x.x[i+1].ch
  				continue
  			case *d:
  				x.d[i].v = v
  			}
  			return
  		}
  
  		switch x := q.(type) {
  		case *x:
  			if x.c > 2*kx {
  				x, i = t.splitX(p, x, pi, i)
  			}
  			pi = i
  			p = x
  			q = x.x[i].ch
  		case *d:
  			switch {
  			case x.c < 2*kd:
  				t.insert(x, i, k, v)
  			default:
  				t.overflow(p, x, pi, i, k, v)
  			}
  			return
  		}
  	}
  }
docs: // Set sets the value associated with k.