mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Revert variable addition
This commit is contained in:
parent
225d0095b3
commit
250ad041e5
1 changed files with 2 additions and 4 deletions
|
|
@ -373,10 +373,8 @@ func DistCmp(target, a, b ID) int {
|
|||
|
||||
// LogDist returns the logarithmic distance between a and b, log2(a ^ b).
|
||||
func LogDist(a, b ID) int {
|
||||
lenA := len(a)
|
||||
totalBits := lenA * 8
|
||||
lz := 0
|
||||
for i := 0; i < lenA; i += 8 {
|
||||
for i := 0; i < len(a); i += 8 {
|
||||
ai := binary.BigEndian.Uint64(a[i : i+8])
|
||||
bi := binary.BigEndian.Uint64(b[i : i+8])
|
||||
x := ai ^ bi
|
||||
|
|
@ -387,5 +385,5 @@ func LogDist(a, b ID) int {
|
|||
break
|
||||
}
|
||||
}
|
||||
return totalBits - lz
|
||||
return len(a)*8 - lz
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue