summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/hash
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-04-10 21:58:24 +0000
committergVisor bot <gvisor-bot@google.com>2021-04-10 21:58:24 +0000
commitbcb519697efd1f61581b4ab42f912ddfcb36a357 (patch)
treeb5d7a22dd9b8c8d06e409cb43e9a7ef20c73814d /pkg/tcpip/hash
parent87c14fc12b0c32b6521b5720a6259e69e0a8d21b (diff)
parentc84ff991240c0ec71dd1978db250bcbfbe4c142b (diff)
Merge release-20210408.0-19-gc84ff9912 (automated)
Diffstat (limited to 'pkg/tcpip/hash')
-rw-r--r--pkg/tcpip/hash/jenkins/jenkins.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/pkg/tcpip/hash/jenkins/jenkins.go b/pkg/tcpip/hash/jenkins/jenkins.go
index 52c22230e..33ff22a7b 100644
--- a/pkg/tcpip/hash/jenkins/jenkins.go
+++ b/pkg/tcpip/hash/jenkins/jenkins.go
@@ -42,26 +42,26 @@ func (s *Sum32) Reset() { *s = 0 }
// Sum32 returns the hash value
func (s *Sum32) Sum32() uint32 {
- hash := *s
+ sCopy := *s
- hash += (hash << 3)
- hash ^= hash >> 11
- hash += hash << 15
+ sCopy += sCopy << 3
+ sCopy ^= sCopy >> 11
+ sCopy += sCopy << 15
- return uint32(hash)
+ return uint32(sCopy)
}
// Write adds more data to the running hash.
//
// It never returns an error.
func (s *Sum32) Write(data []byte) (int, error) {
- hash := *s
+ sCopy := *s
for _, b := range data {
- hash += Sum32(b)
- hash += hash << 10
- hash ^= hash >> 6
+ sCopy += Sum32(b)
+ sCopy += sCopy << 10
+ sCopy ^= sCopy >> 6
}
- *s = hash
+ *s = sCopy
return len(data), nil
}