mirror of
https://github.com/tursom/GoCollections.git
synced 2025-01-14 04:50:17 +08:00
improve bloom HashCode operation
This commit is contained in:
parent
df588d7275
commit
6527759d1e
@ -23,6 +23,7 @@ type (
|
||||
m lang.UInt8Array
|
||||
k uint
|
||||
c uint
|
||||
hashCode int32
|
||||
}
|
||||
)
|
||||
|
||||
@ -128,7 +129,10 @@ func (b *Bloom) Equals(t lang.Object) bool {
|
||||
}
|
||||
|
||||
func (b *Bloom) HashCode() int32 {
|
||||
return int32(murmur3.Sum32(b.m.Bytes()))
|
||||
if b.hashCode == 0 {
|
||||
b.hashCode = int32(murmur3.Sum32(b.m.Bytes()))
|
||||
}
|
||||
return b.hashCode
|
||||
}
|
||||
|
||||
func (b *Bloom) Merge(t *Bloom) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user