Esempio n. 1
0
File: bt.go Progetto: taysom/tau
func (branch *Branch) compact() {
	b := buf.Scratch(LenBuf)
	t := Branch{b, (*head)(unsafe.Pointer(&b.Data[0])), nil}
	t.head.kind = LEAF
	t.head.available = LenBuf - LenHead
	t.head.end = LenBuf
	t.head.block = branch.head.block
	t.head.overflow = branch.head.overflow
	for i := Len(0); i < branch.head.numrecs; i++ {
		t.storeRec(i, branch.getRec(i))
	}
	copy(branch.b.Data, t.b.Data)
}
Esempio n. 2
0
File: bt.go Progetto: taysom/tau
func (leaf *Leaf) compact() {
	b := buf.Scratch(LenBuf)
	t := Leaf{b, (*head)(unsafe.Pointer(&b.Data[0])), nil}
	t.head.kind = LEAF
	t.head.available = LenBuf - LenHead
	t.head.end = LenBuf
	t.head.block = leaf.head.block
	t.head.overflow = leaf.head.overflow
	for i := Len(0); i < leaf.head.numrecs; i++ {
		t.storeRec(i, leaf.getRec(i))
	}
	copy(leaf.b.Data, t.b.Data)
}