Skip to content

Instantly share code, notes, and snippets.

@matiasinsaurralde
Created November 22, 2017 13:22
Show Gist options
  • Save matiasinsaurralde/1c46612d79f52b1018f2c2441c74e957 to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/1c46612d79f52b1018f2c2441c74e957 to your computer and use it in GitHub Desktop.
murmur_diff.txt
14d13
< _ bmixer = new(digest32)
28,32c27
< // New32 returns new 32-bit hasher
< func New32() hash.Hash32 { return New32WithSeed(0) }
<
< // New32WithSeed returns new 32-bit hasher set with explicit seed value
< func New32WithSeed(seed uint32) hash.Hash32 {
---
> func New32() hash.Hash32 {
34d28
< d.seed = seed
42c36
< func (d *digest32) reset() { d.h1 = d.seed }
---
> func (d *digest32) reset() { d.h1 = 0 }
45c39
< h := d.Sum32()
---
> h := d.h1
63c57
< h1 = h1*4 + h1 + 0xe6546b64
---
> h1 = h1*5 + 0xe6546b64
111,118c105
< func Sum32(data []byte) uint32 { return Sum32WithSeed(data, 0) }
<
< // Sum32WithSeed returns the MurmurHash3 sum of data. It is equivalent to the
< // following sequence (without the extra burden and the extra allocation):
< // hasher := New32WithSeed(seed)
< // hasher.Write(data)
< // return hasher.Sum32()
< func Sum32WithSeed(data []byte, seed uint32) uint32 {
---
> func Sum32(data []byte) uint32 {
120c107
< h1 := seed
---
> var h1 uint32 = 0
137c124
< h1 = h1*4 + h1 + 0xe6546b64
---
> h1 = h1*5 + 0xe6546b64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment