added comments and got rid of fixed variable
This commit is contained in:
parent
348e28a4b5
commit
4bcfcd5cc8
|
@ -458,6 +458,6 @@
|
||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "ed1f3f7f1728cd02945f90ca780e9bdc982573a36a5cc8d7e9f19fb40ba2ca19"
|
inputs-digest = "67298e1f8058b85f082dbd32123f2779b11bda282616e595141dba41a8675c39"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
|
|
@ -231,7 +231,9 @@ func (key *KVStoreKey) String() string {
|
||||||
return fmt.Sprintf("KVStoreKey{%p, %s}", key, key.name)
|
return fmt.Sprintf("KVStoreKey{%p, %s}", key, key.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move to TmLibs
|
// PrefixEndBytes returns the []byte that would end a
|
||||||
|
// range query for all []byte with a certain prefix
|
||||||
|
// Deals with last byte of prefix being FF without overflowing
|
||||||
func PrefixEndBytes(prefix []byte) []byte {
|
func PrefixEndBytes(prefix []byte) []byte {
|
||||||
if prefix == nil {
|
if prefix == nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -239,17 +241,16 @@ func PrefixEndBytes(prefix []byte) []byte {
|
||||||
|
|
||||||
end := make([]byte, len(prefix))
|
end := make([]byte, len(prefix))
|
||||||
copy(end, prefix)
|
copy(end, prefix)
|
||||||
finished := false
|
|
||||||
|
|
||||||
for !finished {
|
for {
|
||||||
if end[len(end)-1] != byte(255) {
|
if end[len(end)-1] != byte(255) {
|
||||||
end[len(end)-1]++
|
end[len(end)-1]++
|
||||||
finished = true
|
break
|
||||||
} else {
|
} else {
|
||||||
end = end[:len(end)-1]
|
end = end[:len(end)-1]
|
||||||
if len(end) == 0 {
|
if len(end) == 0 {
|
||||||
end = nil
|
end = nil
|
||||||
finished = true
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue