update gobgp pkg
This commit is contained in:
64
vendor/github.com/dgryski/go-farm/farmhashmk.go
generated
vendored
64
vendor/github.com/dgryski/go-farm/farmhashmk.go
generated
vendored
@@ -1,14 +1,19 @@
|
||||
package farm
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math/bits"
|
||||
)
|
||||
|
||||
func hash32Len5to12(s []byte, seed uint32) uint32 {
|
||||
slen := len(s)
|
||||
a := uint32(len(s))
|
||||
b := uint32(len(s) * 5)
|
||||
c := uint32(9)
|
||||
d := b + seed
|
||||
a += fetch32(s, 0)
|
||||
b += fetch32(s, slen-4)
|
||||
c += fetch32(s, ((slen >> 1) & 4))
|
||||
a += binary.LittleEndian.Uint32(s[0 : 0+4])
|
||||
b += binary.LittleEndian.Uint32(s[slen-4 : slen-4+4])
|
||||
c += binary.LittleEndian.Uint32(s[((slen >> 1) & 4) : ((slen>>1)&4)+4])
|
||||
return fmix(seed ^ mur(c, mur(b, mur(a, d))))
|
||||
}
|
||||
|
||||
@@ -31,32 +36,31 @@ func Hash32(s []byte) uint32 {
|
||||
h := uint32(slen)
|
||||
g := c1 * uint32(slen)
|
||||
f := g
|
||||
a0 := rotate32(fetch32(s, slen-4)*c1, 17) * c2
|
||||
a1 := rotate32(fetch32(s, slen-8)*c1, 17) * c2
|
||||
a2 := rotate32(fetch32(s, slen-16)*c1, 17) * c2
|
||||
a3 := rotate32(fetch32(s, slen-12)*c1, 17) * c2
|
||||
a4 := rotate32(fetch32(s, slen-20)*c1, 17) * c2
|
||||
a0 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-4:slen-4+4])*c1, -17) * c2
|
||||
a1 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-8:slen-8+4])*c1, -17) * c2
|
||||
a2 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-16:slen-16+4])*c1, -17) * c2
|
||||
a3 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-12:slen-12+4])*c1, -17) * c2
|
||||
a4 := bits.RotateLeft32(binary.LittleEndian.Uint32(s[slen-20:slen-20+4])*c1, -17) * c2
|
||||
h ^= a0
|
||||
h = rotate32(h, 19)
|
||||
h = bits.RotateLeft32(h, -19)
|
||||
h = h*5 + 0xe6546b64
|
||||
h ^= a2
|
||||
h = rotate32(h, 19)
|
||||
h = bits.RotateLeft32(h, -19)
|
||||
h = h*5 + 0xe6546b64
|
||||
g ^= a1
|
||||
g = rotate32(g, 19)
|
||||
g = bits.RotateLeft32(g, -19)
|
||||
g = g*5 + 0xe6546b64
|
||||
g ^= a3
|
||||
g = rotate32(g, 19)
|
||||
g = bits.RotateLeft32(g, -19)
|
||||
g = g*5 + 0xe6546b64
|
||||
f += a4
|
||||
f = rotate32(f, 19) + 113
|
||||
iters := (slen - 1) / 20
|
||||
for {
|
||||
a := fetch32(s, 0)
|
||||
b := fetch32(s, 4)
|
||||
c := fetch32(s, 8)
|
||||
d := fetch32(s, 12)
|
||||
e := fetch32(s, 16)
|
||||
f = bits.RotateLeft32(f, -19) + 113
|
||||
for len(s) > 20 {
|
||||
a := binary.LittleEndian.Uint32(s[0 : 0+4])
|
||||
b := binary.LittleEndian.Uint32(s[4 : 4+4])
|
||||
c := binary.LittleEndian.Uint32(s[8 : 8+4])
|
||||
d := binary.LittleEndian.Uint32(s[12 : 12+4])
|
||||
e := binary.LittleEndian.Uint32(s[16 : 16+4])
|
||||
h += a
|
||||
g += b
|
||||
f += c
|
||||
@@ -66,21 +70,17 @@ func Hash32(s []byte) uint32 {
|
||||
f += g
|
||||
g += f
|
||||
s = s[20:]
|
||||
iters--
|
||||
if iters == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
g = rotate32(g, 11) * c1
|
||||
g = rotate32(g, 17) * c1
|
||||
f = rotate32(f, 11) * c1
|
||||
f = rotate32(f, 17) * c1
|
||||
h = rotate32(h+g, 19)
|
||||
g = bits.RotateLeft32(g, -11) * c1
|
||||
g = bits.RotateLeft32(g, -17) * c1
|
||||
f = bits.RotateLeft32(f, -11) * c1
|
||||
f = bits.RotateLeft32(f, -17) * c1
|
||||
h = bits.RotateLeft32(h+g, -19)
|
||||
h = h*5 + 0xe6546b64
|
||||
h = rotate32(h, 17) * c1
|
||||
h = rotate32(h+f, 19)
|
||||
h = bits.RotateLeft32(h, -17) * c1
|
||||
h = bits.RotateLeft32(h+f, -19)
|
||||
h = h*5 + 0xe6546b64
|
||||
h = rotate32(h, 17) * c1
|
||||
h = bits.RotateLeft32(h, -17) * c1
|
||||
return h
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user