Update keyPath to be ceil(maxLevels/8)

This commit is contained in:
2021-09-30 17:34:47 +02:00
parent 9eb7c8e265
commit 0921cac304
3 changed files with 43 additions and 23 deletions

2
vt.go
View File

@@ -44,7 +44,7 @@ func (p *params) keysValuesToKvs(ks, vs [][]byte) ([]kv, error) {
}
kvs := make([]kv, len(ks))
for i := 0; i < len(ks); i++ {
keyPath := make([]byte, p.hashFunction.Len())
keyPath := make([]byte, int(math.Ceil(float64(p.maxLevels)/float64(8)))) //nolint:gomnd
copy(keyPath[:], ks[i])
kvs[i].pos = i
kvs[i].keyPath = keyPath