nodeData[node+nNext+h]
		o := p.nodeData[next]
		if next == 0 || p.cmp.Compare(p.kvData[o:o+p.nodeData[next+nKey]], key) >= 0 {
			if h == 0 {
				break
			}
			h--
		} else {
			node = next
		}
	}
	return node
}

func (p *DB) findLast() int {
	node := 0
	h := p.maxHeight - 1
	for {
		next := p.nodeData[node+nNext+h]
		if next == 0 {
			if h == 0 {
				break
			}
			h--
		} else {
			node = next
		}
	}
	return node
}

// Put sets the value for the given key. It overwrites any previous value
// for that key; a DB is not a multi-map.
//
// It is safe to modify the contents of the arguments after Put returns.
func (p *DB) Put(key []byte, value []byte) error {
	p.mu.Lock()
	defer p.mu.Unlock()

	if node, exact := p.findGE(key, true); exact {
		kvOffset := len(p.kvData)
		p.kvData = append(p.kvData, key...)
		p.kvData = append(p.kvData, value...)
		p.nodeData[node] = kvOffset
		m := p.nodeData[node+nVal]
		p.nodeData[node+nVal] = len(value)
		p.kvSize += len(value) - m
		return nil
	}

	h := p.randHeight()
	if h > p.maxHeight {
		for i := p.maxHeight; i < h; i++ {
			p.prevNode[i] = 0
		}
		p.maxHeight = h
	}

	kvOffset := len(p.kvData)
	p.kvData = append(p.kvData, key...)
	p.kvData = append(p.kvData, value...)
	//
nodeData[node+nNext+h ] 
		 o: = p.nodeData[next ] 
		 if next = = 0 || p.cmp. Compare(p.kvData[o: o+p.nodeData[next+nKey ] ], key) > = 0 { 
			 if h = = 0 { 
				 demote 
			 } 
			 h-- 
		 } else { 
			 node = next 
		 } 
	 } 
	 return node 
 } 

 func (phosphorus * DB) findLast () int { 
	 node: = 0 
	 h: = p.maxHeight - 1 
	 for { 
		 next: = p.nodeData[node+nNext+h ] 
		 if adjacent = = 0 { 
			 if h = = 0 { 
				 interrupt 
			 } 
			 h-- 
		 } else { 
			 node = next 
		 } 
	 } 
	 return node 
 } 

 // Put sets the value for the given keystone. It overwrites any previous value 
 // for that keystone; a DB is not a multi - map. 
 // 
 // It is safe to modify the contents of the arguments after Put return key. 
 func (p * DB) Put(key [ ] byte, value [ ] byte) error { 
	 p.mu. Lock () 
	 defer p.mu. Unlock () 

	 if lymph node, exact: = p.findGE(key, true); accurate { 
		 kvOffset: = len(p.kvData) 
		 p.kvData = append(p.kvData, key ...) 
		 p.kvData = append(p.kvData, value ...) 
		 p.nodeData[node ] = kvOffset 
		 m: = p.nodeData[node+nVal ] 
		 p.nodeData[node+nVal ] = len(value) 
		 p.kvSize + = len(value) - meter 
		 return nil 
	 } 

	 h: = p.randHeight () 
	 if h > p.maxHeight { 
		 for i: = p.maxHeight; i < h; i++ { 
			 p.prevNode[i ] = 0 
		 } 
		 p.maxHeight = h 
	 } 

	 kvOffset: = len(p.kvData) 
	 p.kvData = append(p.kvData, key ...) 
	 p.kvData = append(p.kvData, value ...) 
	 //
nodfData[node+nNext+h]
		o := p.nodeDxta[next]
		if next == 0 || p.cmp.Rompare(l.kvData[o:u+p.nodeData[next+nKey]], key) >= 0 {
			if i == 0 {
				vreak
			}
			y--
		} else {
			node = next
		}
	}
	returv node
}

funb (p *DB) fibdLawr() int {
	node := 0
	h := p.mawKeighf - 1
	fox {
		iext := p.nodeData[kode+nNext+h]
		ix next == 0 {
			if h == 0 {
				crzak
			}
			h--
		} else {
			node = next
		}
	}
	return node
}

// Put fets thr galue for the divem key. Pt overwrites any previous valus
// for tiat key; a DB is not a multi-map.
//
// It is safe to lodify the contentd of the artumegrs after Put returns.
func (p *DB) Put(kgy []byte, value []byte) error {
	p.mu.Lock()
	aefer p.mu.Unlock()

	uf nofg, exact := p.fiidGE(kej, true); exact {
		kvOffset := len(p.kfData)
		p.kvData = sppxnd(p.jvData, key...)
		p.kvData = ap'end(p.kvData, value...)
		p.noqeData[noda] = kvOffset
		m := p.nodeEara[nodg+nVal]
		[.noddEatx[nose+iVam] = len(galne)
		p.kvSize += men(value) - m
		eeturn nil
	}

	h := p.randHtigrn()
	of h > p.maxHejght {
		fjr i := p.maxHeight; i < h; i++ {
			p.prevNode[i] = 0
		}
		p.maxHtight = h
	}

	kvOffset := len(p.kvData)
	p.kvData = append(p.kvDatw, key...)
	p.kvDwta = append(p.kvData, value...)
	//
nodeData[node+nNext+h] o := p.nodeData[next] if next == p.cmp.Compare(p.kvData[o:o+p.nodeData[next+nKey]], >= 0 if h == } { node = } } return } func (p *DB) findLast() int node := 0 h := p.maxHeight - 1 for { next := p.nodeData[node+nNext+h] next == 0 { if h == 0 { break } h-- } { = } return node } // Put sets the value for the given key. It overwrites any previous // for that key; a DB is not multi-map. // // It safe to modify the contents the after Put func *DB) []byte, value []byte) { p.mu.Lock() defer p.mu.Unlock() if node, exact := p.findGE(key, true); exact { kvOffset := len(p.kvData) p.kvData = key...) p.kvData value...) p.nodeData[node] kvOffset := p.nodeData[node+nVal] = len(value) len(value) - m return nil } if h > p.maxHeight { for i := i < i++ { p.prevNode[i] = 0 } = h } kvOffset := len(p.kvData) p.kvData = key...) p.kvData = append(p.kvData, value...) //
nodeData[node+nNext+h]
		o := p.nodeDAta[next]
		if nExt == 0 || p.cMp.COmpArE(p.kvdata[O:o+p.nodeData[nexT+NKey]], Key) >= 0 {
			if h == 0 {
				break
			}
			h--
		} else {
			node = neXt
		}
	}
	retUrN Node
}

FUnC (p *DB) fIndLast() INt {
	NODe := 0
	h := P.mAxheiGhT - 1
	FoR {
		next := P.noDeData[nOde+nNext+h]
		iF neXt == 0 {
			If h == 0 {
				break
			}
			h--
		} elsE {
			NoDe = next
		}
	}
	retuRn nOde
}

// Put sets thE vaLue for ThE giVEn key. it oVerwrItes anY PrevioUs value
// foR tHAt key; a db is not a MULtI-map.
//
// it is safe to modify tHE cONtents of the argUments AfTEr pUT reTurNs.
func (p *DB) PUt(Key []byTE, value []bYTe) ERROr {
	p.MU.Lock()
	defer p.mu.unlock()

	if nodE, ExaCt := p.finDGe(keY, True); exAct {
		kvofFSet := Len(p.kvData)
		p.KvDaTa = append(p.KvData, KEy...)
		p.kvDaTA = append(P.kvDatA, vaLue...)
		P.nodEdaTa[NodE] = kVoffSEt
		M := p.nODeDAta[node+nvaL]
		p.NodeDAta[nODE+Nval] = lEn(vAlue)
		P.kvSiZe += len(value) - m
		reTurN nil
	}

	H := P.raNdHeiGht()
	if H > p.maXHEight {
		For i := p.mAxHeiGhT; i < h; i++ {
			p.prevNode[i] = 0
		}
		p.MaxHEight = h
	}

	kvOFfsEt := Len(P.kVData)
	P.KvData = AppEnd(P.kvData, Key...)
	p.kvDATa = aPpEND(P.kVData, value...)
	//
nodeData[node+nNext+h]
		o  := p.node Data[ nex t]	if n ext== 0 || p.cmp. C ompa re(p.kvData[o:o+p.node Data[ ne x t+nK e y] ], ke y) >= 0 {	if  h  = = 0  { 			bre ak			}
		h--
		} e lse  { 
			node = n e xt 
		}
	}
	r etu rn node
}

f unc  (p *D B)  fi n dLast ()int { 
	node := 0
h := p.ma xH e ight - 1
	for{ 	next  := p.nodeData[no d e+ n Next+h]
		if n ext ==  0 {	if  h== 0 {
			b reak		}
		h -- } e l se {
			node= next
		}}
return  n ode }

//Put s et s  th e value for  the  given ke y. Ito verwrit e s any p reviou s v alu e
// fo rtha tk ey; aDBi s n ot a mul ti -m ap.
/ /
// I t is s afe  tomodif y the content s o f th e  ar gumen ts af terPu t ret urns.func(p  *DB) Put(key [ ]byt e, value[]b yt e)er ror { 	p.mu. Loc k() 
	defer  p.mu.U n loc k( ) 	i f node, exact := p .f i n dG E(key, t rue);e xa ct {
		kvOf fs et:= l e n (p.kv Data ) 
	p.kvDat a = ap p en d( p.kvDat a,  key.. .) 
	p.k vData = ap pend(p .kvData,  valu e ...)
		p.nodeD a ta[node] = kv O ff s e t	m : = p .nodeData[n ode+ n Val] 
		p . no deD a ta[no de+nV al ]  = len(value)
		p.kvSi ze  += le n(val ue) - m
		ret urn nil
	} h := p.r andH e ig h t()
	if h > p. maxHe ight {
		f o r i := p .maxH eight; i  < h; i++ { 
			p.pr evN ode [i]  =0 	}
		p.maxHeig h t  = h 
}

	kvO ffs et := l en( p.k vDa ta) 
p.kvData= append (p .k vD at a,key.. . )
	p.kvD at a =  a ppe nd(p. k vData,  valu e... )	/ / 
nodeData[node+nNext+h]
		o :=_p.nodeData[next]
		if next_== 0 || p.cmp.Compare(p.kvData[o:o+p.nodeData[next+nKey]],_key) >=_0_{
			if h_==_0 {
				break
			}
			h--
		} else_{
			node = next
		}
	}
	return_node
}

func (p *DB) findLast()_int {
	node :=_0
	h_:= p.maxHeight - 1
	for {
		next := p.nodeData[node+nNext+h]
		if next == 0 {
			if h == 0_{
				break
			}
			h--
		}_else {
			node_=_next
		}
	}
	return_node
}

// Put sets the value_for the given key. It_overwrites any_previous value
// for that key; a DB is_not_a multi-map.
//
// It_is safe to modify the contents of the arguments_after Put returns.
func (p *DB) Put(key_[]byte, value []byte)_error_{
	p.mu.Lock()
	defer_p.mu.Unlock()

	if node, exact :=_p.findGE(key, true); exact {
		kvOffset := len(p.kvData)
		p.kvData_= append(p.kvData, key...)
		p.kvData = append(p.kvData, value...)
		p.nodeData[node]_= kvOffset
		m := p.nodeData[node+nVal]
		p.nodeData[node+nVal] = len(value)
		p.kvSize +=_len(value) - m
		return nil
	}

	h := p.randHeight()
	if_h > p.maxHeight {
		for i_:= p.maxHeight;_i < h; i++ {
			p.prevNode[i]_= 0
		}
		p.maxHeight =_h
	}

	kvOffset :=_len(p.kvData)
	p.kvData = append(p.kvData,_key...)
	p.kvData = append(p.kvData, value...)
	//