Skip to content

Commit 80d1f8e

Browse files
committed
Lint: fix comments in murmur3 code
1 parent c99f5cf commit 80d1f8e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

murmur3/murmur3.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// Package murmer3 provides functions implementing the Murmur3 hashing algorithm.
5+
// Package murmur3 provides functions implementing the Murmur3 hashing algorithm.
66
// The ClojureJVM version imported the Guava Murmur3 implementation
77
// and made some changes.
88
// For ClojureCLR and here, I copied the API stubs, then implemented the API
@@ -22,14 +22,17 @@ const n uint32 = 0xe6546b64
2222

2323
// The public interface
2424

25+
// HashInt32 computes a hash value for an int32
2526
func HashInt32(input int32) uint32 {
2627
return HashUInt32(uint32(input))
2728
}
2829

30+
// HashInt64 computes a hash value for an int64
2931
func HashInt64(input int64) uint32 {
3032
return HashUInt64(uint64(input))
3133
}
3234

35+
// HashUInt32 computes a hash value for a uint32
3336
func HashUInt32(input uint32) uint32 {
3437
if input == 0 {
3538
return 0
@@ -40,6 +43,7 @@ func HashUInt32(input uint32) uint32 {
4043
return Finalize(hash, 4)
4144
}
4245

46+
// HashUInt64 computes a hash value for a uint64
4347
func HashUInt64(input uint64) uint32 {
4448
if input == 0 {
4549
return 0
@@ -57,6 +61,7 @@ func HashUInt64(input uint64) uint32 {
5761
return Finalize(hash, 8)
5862
}
5963

64+
// HashString computes a hash value for a string
6065
func HashString(input string) uint32 {
6166

6267
hash := seed
@@ -88,13 +93,15 @@ func HashString(input string) uint32 {
8893
return Finalize(hash, int32(len))
8994
}
9095

96+
// MixKey scrambles the bits in 32-bit value
9197
func MixKey(key uint32) uint32 {
9298
key *= c1
9399
key = rotateLeft(key, r1)
94100
key *= c2
95101
return key
96102
}
97103

104+
// MixHash mixes a new 32-bit value into a given hash value
98105
func MixHash(hash uint32, key uint32) uint32 {
99106
hash ^= key
100107
hash = rotateLeft(hash, r2)
@@ -103,7 +110,7 @@ func MixHash(hash uint32, key uint32) uint32 {
103110

104111
}
105112

106-
// finalize forces all bits of a hash block to avalanche
113+
// Finalize forces all bits of a hash block to avalanche
107114
func Finalize(hash uint32, length int32) uint32 {
108115
hash ^= uint32(length)
109116
hash ^= hash >> 16
@@ -114,6 +121,7 @@ func Finalize(hash uint32, length int32) uint32 {
114121
return hash
115122
}
116123

124+
// FinalizeCollHash forces all bits of a hash block to avalanche, and add in a length count
117125
func FinalizeCollHash(hash uint32, count int32) uint32 {
118126
h1 := seed
119127
k1 := MixKey(hash)

0 commit comments

Comments
 (0)