aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/pot/address.go
diff options
context:
space:
mode:
authorgluk256 <gluk256@users.noreply.github.com>2019-01-12 03:42:33 +0800
committerViktor TrĂ³n <viktor.tron@gmail.com>2019-01-12 03:42:33 +0800
commit1636d9574be4e3df318f16bd1bf2741cf79b76a1 (patch)
treef3fb5986f98a1a149a65da93c9f9ddfff001f5fa /swarm/pot/address.go
parent88168ff5c57b1a9c944d02e93e6e49368ccc968f (diff)
downloaddexon-1636d9574be4e3df318f16bd1bf2741cf79b76a1.tar
dexon-1636d9574be4e3df318f16bd1bf2741cf79b76a1.tar.gz
dexon-1636d9574be4e3df318f16bd1bf2741cf79b76a1.tar.bz2
dexon-1636d9574be4e3df318f16bd1bf2741cf79b76a1.tar.lz
dexon-1636d9574be4e3df318f16bd1bf2741cf79b76a1.tar.xz
dexon-1636d9574be4e3df318f16bd1bf2741cf79b76a1.tar.zst
dexon-1636d9574be4e3df318f16bd1bf2741cf79b76a1.zip
swarm/pot: pot.remove fixed (#18431)
* swarm/pot: refactored pot.remove(), updated comments * swarm/pot: comments updated
Diffstat (limited to 'swarm/pot/address.go')
-rw-r--r--swarm/pot/address.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/swarm/pot/address.go b/swarm/pot/address.go
index 5af3381a7..91cada2e8 100644
--- a/swarm/pot/address.go
+++ b/swarm/pot/address.go
@@ -162,7 +162,6 @@ func ToBytes(v Val) []byte {
}
// DefaultPof returns a proximity order comparison operator function
-// where all
func DefaultPof(max int) func(one, other Val, pos int) (int, bool) {
return func(one, other Val, pos int) (int, bool) {
po, eq := proximityOrder(ToBytes(one), ToBytes(other), pos)
@@ -174,6 +173,9 @@ func DefaultPof(max int) func(one, other Val, pos int) (int, bool) {
}
}
+// proximityOrder returns two parameters:
+// 1. relative proximity order of the arguments one & other;
+// 2. boolean indicating whether the full match occurred (one == other).
func proximityOrder(one, other []byte, pos int) (int, bool) {
for i := pos / 8; i < len(one); i++ {
if one[i] == other[i] {