mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
trie: simplify code
This commit is contained in:
parent
b1809d13d1
commit
59654d9c3a
1 changed files with 4 additions and 7 deletions
|
|
@ -138,17 +138,14 @@ func decodeNibbles(nibbles []byte, bytes []byte) {
|
||||||
|
|
||||||
// prefixLen returns the length of the common prefix of a and b.
|
// prefixLen returns the length of the common prefix of a and b.
|
||||||
func prefixLen(a, b []byte) int {
|
func prefixLen(a, b []byte) int {
|
||||||
var i, length = 0, len(a)
|
n := min(len(a), len(b))
|
||||||
if len(b) < length {
|
for i := range n {
|
||||||
length = len(b)
|
|
||||||
}
|
|
||||||
for ; i < length; i++ {
|
|
||||||
if a[i] != b[i] {
|
if a[i] != b[i] {
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
// hasTerm returns whether a hex key has the terminator flag.
|
// hasTerm returns whether a hex key has the terminator flag.
|
||||||
func hasTerm(s []byte) bool {
|
func hasTerm(s []byte) bool {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue