mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
uint8 cast of xor in proximity
This commit is contained in:
parent
0206ad78ad
commit
25245fe1c5
1 changed files with 2 additions and 2 deletions
|
|
@ -457,12 +457,12 @@ func proximity(one, other Address) (ret int) {
|
||||||
for i := 0; i < len(one); i++ {
|
for i := 0; i < len(one); i++ {
|
||||||
oxo := one[i] ^ other[i]
|
oxo := one[i] ^ other[i]
|
||||||
for j := 0; j < 8; j++ {
|
for j := 0; j < 8; j++ {
|
||||||
if (oxo>>uint8(7-j))&0x1 != 0 {
|
if (uint8(oxo)>>uint8(7-j))&0x1 != 0 {
|
||||||
return i*8 + j
|
return i*8 + j
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return len(one)*8 - 1
|
return len(one) * 8
|
||||||
}
|
}
|
||||||
|
|
||||||
// proxCmp compares the distances a->target and b->target.
|
// proxCmp compares the distances a->target and b->target.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue