don't prepend (nil, 0], make first bin start at nil
This commit is contained in:
parent
deb8b6b71c
commit
321f5fe368
@ -138,9 +138,8 @@ func MakePaths(prefix []byte, nbins uint) [][]byte {
|
|||||||
|
|
||||||
func eachPrefixRange(prefix []byte, nbins uint, callback func ([]byte, []byte)) {
|
func eachPrefixRange(prefix []byte, nbins uint, callback func ([]byte, []byte)) {
|
||||||
prefixes := MakePaths(prefix, nbins)
|
prefixes := MakePaths(prefix, nbins)
|
||||||
// pre- and postpend nil to include root & tail
|
prefixes = append(prefixes, nil) // include tail
|
||||||
prefixes = append(prefixes, nil)
|
prefixes[0] = nil // set bin 0 left bound to nil to include root
|
||||||
prefixes = append([][]byte{nil}, prefixes...)
|
|
||||||
for i := 0; i < len(prefixes)-1; i++ {
|
for i := 0; i < len(prefixes)-1; i++ {
|
||||||
key := prefixes[i]
|
key := prefixes[i]
|
||||||
if len(key)%2 != 0 { // zero-pad for odd-length keys
|
if len(key)%2 != 0 { // zero-pad for odd-length keys
|
||||||
|
Loading…
Reference in New Issue
Block a user