24
vendor/github.com/dgryski/go-farm/.gitignore
generated
vendored
Normal file
24
vendor/github.com/dgryski/go-farm/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
target
|
||||
39
vendor/github.com/dgryski/go-farm/.travis.yml
generated
vendored
Normal file
39
vendor/github.com/dgryski/go-farm/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
language: go
|
||||
|
||||
sudo: false
|
||||
|
||||
branches:
|
||||
except:
|
||||
- release
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
- travis
|
||||
|
||||
go:
|
||||
- 1.11.x
|
||||
- 1.12.x
|
||||
- tip
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
|
||||
before_install:
|
||||
- if [ -n "$GH_USER" ]; then git config --global github.user ${GH_USER}; fi;
|
||||
- if [ -n "$GH_TOKEN" ]; then git config --global github.token ${GH_TOKEN}; fi;
|
||||
- go get github.com/mattn/goveralls
|
||||
|
||||
before_script:
|
||||
- make deps
|
||||
|
||||
script:
|
||||
- make qa
|
||||
|
||||
after_failure:
|
||||
- cat ./target/test/report.xml
|
||||
|
||||
after_success:
|
||||
- if [ "$TRAVIS_GO_VERSION" = "1.9" ]; then $HOME/gopath/bin/goveralls -covermode=count -coverprofile=target/report/coverage.out -service=travis-ci; fi;
|
||||
23
vendor/github.com/dgryski/go-farm/LICENSE
generated
vendored
Normal file
23
vendor/github.com/dgryski/go-farm/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
As this is a highly derivative work, I have placed it under the same license as the original implementation:
|
||||
|
||||
Copyright (c) 2014-2017 Damian Gryski
|
||||
Copyright (c) 2016-2017 Nicola Asuni - Tecnick.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
203
vendor/github.com/dgryski/go-farm/Makefile
generated
vendored
Normal file
203
vendor/github.com/dgryski/go-farm/Makefile
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
# MAKEFILE
|
||||
#
|
||||
# @author Nicola Asuni <info@tecnick.com>
|
||||
# @link https://github.com/dgryski/go-farm
|
||||
#
|
||||
# This file is intended to be executed in a Linux-compatible system.
|
||||
# It also assumes that the project has been cloned in the right path under GOPATH:
|
||||
# $GOPATH/src/github.com/dgryski/go-farm
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# List special make targets that are not associated with files
|
||||
.PHONY: help all test format fmtcheck vet lint coverage cyclo ineffassign misspell structcheck varcheck errcheck gosimple astscan qa deps clean nuke
|
||||
|
||||
# Use bash as shell (Note: Ubuntu now uses dash which doesn't support PIPESTATUS).
|
||||
SHELL=/bin/bash
|
||||
|
||||
# CVS path (path to the parent dir containing the project)
|
||||
CVSPATH=github.com/dgryski
|
||||
|
||||
# Project owner
|
||||
OWNER=dgryski
|
||||
|
||||
# Project vendor
|
||||
VENDOR=dgryski
|
||||
|
||||
# Project name
|
||||
PROJECT=go-farm
|
||||
|
||||
# Project version
|
||||
VERSION=$(shell cat VERSION)
|
||||
|
||||
# Name of RPM or DEB package
|
||||
PKGNAME=${VENDOR}-${PROJECT}
|
||||
|
||||
# Current directory
|
||||
CURRENTDIR=$(shell pwd)
|
||||
|
||||
# GO lang path
|
||||
ifneq ($(GOPATH),)
|
||||
ifeq ($(findstring $(GOPATH),$(CURRENTDIR)),)
|
||||
# the defined GOPATH is not valid
|
||||
GOPATH=
|
||||
endif
|
||||
endif
|
||||
ifeq ($(GOPATH),)
|
||||
# extract the GOPATH
|
||||
GOPATH=$(firstword $(subst /src/, ,$(CURRENTDIR)))
|
||||
endif
|
||||
|
||||
# --- MAKE TARGETS ---
|
||||
|
||||
# Display general help about this command
|
||||
help:
|
||||
@echo ""
|
||||
@echo "$(PROJECT) Makefile."
|
||||
@echo "GOPATH=$(GOPATH)"
|
||||
@echo "The following commands are available:"
|
||||
@echo ""
|
||||
@echo " make qa : Run all the tests"
|
||||
@echo " make test : Run the unit tests"
|
||||
@echo ""
|
||||
@echo " make format : Format the source code"
|
||||
@echo " make fmtcheck : Check if the source code has been formatted"
|
||||
@echo " make vet : Check for suspicious constructs"
|
||||
@echo " make lint : Check for style errors"
|
||||
@echo " make coverage : Generate the coverage report"
|
||||
@echo " make cyclo : Generate the cyclomatic complexity report"
|
||||
@echo " make ineffassign : Detect ineffectual assignments"
|
||||
@echo " make misspell : Detect commonly misspelled words in source files"
|
||||
@echo " make structcheck : Find unused struct fields"
|
||||
@echo " make varcheck : Find unused global variables and constants"
|
||||
@echo " make errcheck : Check that error return values are used"
|
||||
@echo " make gosimple : Suggest code simplifications"
|
||||
@echo " make astscan : GO AST scanner"
|
||||
@echo ""
|
||||
@echo " make docs : Generate source code documentation"
|
||||
@echo ""
|
||||
@echo " make deps : Get the dependencies"
|
||||
@echo " make clean : Remove any build artifact"
|
||||
@echo " make nuke : Deletes any intermediate file"
|
||||
@echo ""
|
||||
|
||||
|
||||
# Alias for help target
|
||||
all: help
|
||||
|
||||
# Run the unit tests
|
||||
test:
|
||||
@mkdir -p target/test
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) \
|
||||
go test \
|
||||
-covermode=atomic \
|
||||
-bench=. \
|
||||
-race \
|
||||
-cpuprofile=target/report/cpu.out \
|
||||
-memprofile=target/report/mem.out \
|
||||
-mutexprofile=target/report/mutex.out \
|
||||
-coverprofile=target/report/coverage.out \
|
||||
-v ./... | \
|
||||
tee >(PATH=$(GOPATH)/bin:$(PATH) go-junit-report > target/test/report.xml); \
|
||||
test $${PIPESTATUS[0]} -eq 0
|
||||
|
||||
# Format the source code
|
||||
format:
|
||||
@find . -type f -name "*.go" -exec gofmt -s -w {} \;
|
||||
|
||||
# Check if the source code has been formatted
|
||||
fmtcheck:
|
||||
@mkdir -p target
|
||||
@find . -type f -name "*.go" -exec gofmt -s -d {} \; | tee target/format.diff
|
||||
@test ! -s target/format.diff || { echo "ERROR: the source code has not been formatted - please use 'make format' or 'gofmt'"; exit 1; }
|
||||
|
||||
# Check for syntax errors
|
||||
vet:
|
||||
GOPATH=$(GOPATH) go vet .
|
||||
|
||||
# Check for style errors
|
||||
lint:
|
||||
GOPATH=$(GOPATH) PATH=$(GOPATH)/bin:$(PATH) golint .
|
||||
|
||||
# Generate the coverage report
|
||||
coverage:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) \
|
||||
go tool cover -html=target/report/coverage.out -o target/report/coverage.html
|
||||
|
||||
# Report cyclomatic complexity
|
||||
cyclo:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) gocyclo -avg ./ | tee target/report/cyclo.txt ; test $${PIPESTATUS[0]} -eq 0
|
||||
|
||||
# Detect ineffectual assignments
|
||||
ineffassign:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) ineffassign ./ | tee target/report/ineffassign.txt ; test $${PIPESTATUS[0]} -eq 0
|
||||
|
||||
# Detect commonly misspelled words in source files
|
||||
misspell:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) misspell -error ./ | tee target/report/misspell.txt ; test $${PIPESTATUS[0]} -eq 0
|
||||
|
||||
# Find unused struct fields
|
||||
structcheck:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) structcheck -a ./ | tee target/report/structcheck.txt
|
||||
|
||||
# Find unused global variables and constants
|
||||
varcheck:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) varcheck -e ./ | tee target/report/varcheck.txt
|
||||
|
||||
# Check that error return values are used
|
||||
errcheck:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) errcheck ./ | tee target/report/errcheck.txt
|
||||
|
||||
# Suggest code simplifications
|
||||
gosimple:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) gosimple ./ | tee target/report/gosimple.txt
|
||||
|
||||
# AST scanner
|
||||
astscan:
|
||||
@mkdir -p target/report
|
||||
GOPATH=$(GOPATH) gas .//*.go | tee target/report/astscan.txt
|
||||
|
||||
# Generate source docs
|
||||
docs:
|
||||
@mkdir -p target/docs
|
||||
nohup sh -c 'GOPATH=$(GOPATH) godoc -http=127.0.0.1:6060' > target/godoc_server.log 2>&1 &
|
||||
wget --directory-prefix=target/docs/ --execute robots=off --retry-connrefused --recursive --no-parent --adjust-extension --page-requisites --convert-links http://127.0.0.1:6060/pkg/github.com/${VENDOR}/${PROJECT}/ ; kill -9 `lsof -ti :6060`
|
||||
@echo '<html><head><meta http-equiv="refresh" content="0;./127.0.0.1:6060/pkg/'${CVSPATH}'/'${PROJECT}'/index.html"/></head><a href="./127.0.0.1:6060/pkg/'${CVSPATH}'/'${PROJECT}'/index.html">'${PKGNAME}' Documentation ...</a></html>' > target/docs/index.html
|
||||
|
||||
# Alias to run all quality-assurance checks
|
||||
qa: fmtcheck test vet lint coverage cyclo ineffassign misspell structcheck varcheck errcheck gosimple astscan
|
||||
|
||||
# --- INSTALL ---
|
||||
|
||||
# Get the dependencies
|
||||
deps:
|
||||
GOPATH=$(GOPATH) go get ./...
|
||||
GOPATH=$(GOPATH) go get golang.org/x/lint/golint
|
||||
GOPATH=$(GOPATH) go get github.com/jstemmer/go-junit-report
|
||||
GOPATH=$(GOPATH) go get github.com/axw/gocov/gocov
|
||||
GOPATH=$(GOPATH) go get github.com/fzipp/gocyclo
|
||||
GOPATH=$(GOPATH) go get github.com/gordonklaus/ineffassign
|
||||
GOPATH=$(GOPATH) go get github.com/client9/misspell/cmd/misspell
|
||||
GOPATH=$(GOPATH) go get github.com/opennota/check/cmd/structcheck
|
||||
GOPATH=$(GOPATH) go get github.com/opennota/check/cmd/varcheck
|
||||
GOPATH=$(GOPATH) go get github.com/kisielk/errcheck
|
||||
GOPATH=$(GOPATH) go get honnef.co/go/tools/cmd/gosimple
|
||||
GOPATH=$(GOPATH) go get github.com/GoASTScanner/gas
|
||||
|
||||
# Remove any build artifact
|
||||
clean:
|
||||
GOPATH=$(GOPATH) go clean ./...
|
||||
|
||||
# Deletes any intermediate file
|
||||
nuke:
|
||||
rm -rf ./target
|
||||
GOPATH=$(GOPATH) go clean -i ./...
|
||||
41
vendor/github.com/dgryski/go-farm/README.md
generated
vendored
Normal file
41
vendor/github.com/dgryski/go-farm/README.md
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
# go-farm
|
||||
|
||||
*Google's FarmHash hash functions implemented in Go*
|
||||
|
||||
[](https://github.com/dgryski/go-farm/tree/master)
|
||||
[](https://travis-ci.org/dgryski/go-farm?branch=master)
|
||||
[](https://coveralls.io/github/dgryski/go-farm?branch=master)
|
||||
[](https://goreportcard.com/report/github.com/dgryski/go-farm)
|
||||
[](http://godoc.org/github.com/dgryski/go-farm)
|
||||
|
||||
## Description
|
||||
|
||||
FarmHash, a family of hash functions.
|
||||
|
||||
This is a (mechanical) translation of the non-SSE4/non-AESNI hash functions from Google's FarmHash (https://github.com/google/farmhash).
|
||||
|
||||
|
||||
FarmHash provides hash functions for strings and other data.
|
||||
The functions mix the input bits thoroughly but are not suitable for cryptography.
|
||||
|
||||
All members of the FarmHash family were designed with heavy reliance on previous work by Jyrki Alakuijala, Austin Appleby, Bob Jenkins, and others.
|
||||
|
||||
For more information please consult https://github.com/google/farmhash
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
This application is written in Go language, please refer to the guides in https://golang.org for getting started.
|
||||
|
||||
This project include a Makefile that allows you to test and build the project with simple commands.
|
||||
To see all available options:
|
||||
```bash
|
||||
make help
|
||||
```
|
||||
|
||||
## Running all tests
|
||||
|
||||
Before committing the code, please check if it passes all tests using
|
||||
```bash
|
||||
make qa
|
||||
```
|
||||
1
vendor/github.com/dgryski/go-farm/VERSION
generated
vendored
Normal file
1
vendor/github.com/dgryski/go-farm/VERSION
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
2.0.1
|
||||
32
vendor/github.com/dgryski/go-farm/basics.go
generated
vendored
Normal file
32
vendor/github.com/dgryski/go-farm/basics.go
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
package farm
|
||||
|
||||
import "math/bits"
|
||||
|
||||
// Some primes between 2^63 and 2^64 for various uses.
|
||||
const k0 uint64 = 0xc3a5c85c97cb3127
|
||||
const k1 uint64 = 0xb492b66fbe98f273
|
||||
const k2 uint64 = 0x9ae16a3b2f90404f
|
||||
|
||||
// Magic numbers for 32-bit hashing. Copied from Murmur3.
|
||||
const c1 uint32 = 0xcc9e2d51
|
||||
const c2 uint32 = 0x1b873593
|
||||
|
||||
// A 32-bit to 32-bit integer hash copied from Murmur3.
|
||||
func fmix(h uint32) uint32 {
|
||||
h ^= h >> 16
|
||||
h *= 0x85ebca6b
|
||||
h ^= h >> 13
|
||||
h *= 0xc2b2ae35
|
||||
h ^= h >> 16
|
||||
return h
|
||||
}
|
||||
|
||||
func mur(a, h uint32) uint32 {
|
||||
// Helper from Murmur3 for combining two 32-bit values.
|
||||
a *= c1
|
||||
a = bits.RotateLeft32(a, -17)
|
||||
a *= c2
|
||||
h ^= a
|
||||
h = bits.RotateLeft32(h, -19)
|
||||
return h*5 + 0xe6546b64
|
||||
}
|
||||
194
vendor/github.com/dgryski/go-farm/farmhashcc.go
generated
vendored
Normal file
194
vendor/github.com/dgryski/go-farm/farmhashcc.go
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
package farm
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math/bits"
|
||||
)
|
||||
|
||||
// This file provides a 32-bit hash equivalent to CityHash32 (v1.1.1)
|
||||
// and a 128-bit hash equivalent to CityHash128 (v1.1.1). It also provides
|
||||
// a seeded 32-bit hash function similar to CityHash32.
|
||||
|
||||
func hash32Len13to24Seed(s []byte, seed uint32) uint32 {
|
||||
slen := len(s)
|
||||
a := binary.LittleEndian.Uint32(s[-4+(slen>>1) : -4+(slen>>1)+4])
|
||||
b := binary.LittleEndian.Uint32(s[4 : 4+4])
|
||||
c := binary.LittleEndian.Uint32(s[slen-8 : slen-8+4])
|
||||
d := binary.LittleEndian.Uint32(s[(slen >> 1) : (slen>>1)+4])
|
||||
e := binary.LittleEndian.Uint32(s[0 : 0+4])
|
||||
f := binary.LittleEndian.Uint32(s[slen-4 : slen-4+4])
|
||||
h := d*c1 + uint32(slen) + seed
|
||||
a = bits.RotateLeft32(a, -12) + f
|
||||
h = mur(c, h) + a
|
||||
a = bits.RotateLeft32(a, -3) + c
|
||||
h = mur(e, h) + a
|
||||
a = bits.RotateLeft32(a+f, -12) + d
|
||||
h = mur(b^seed, h) + a
|
||||
return fmix(h)
|
||||
}
|
||||
|
||||
func hash32Len0to4(s []byte, seed uint32) uint32 {
|
||||
slen := len(s)
|
||||
b := seed
|
||||
c := uint32(9)
|
||||
for i := 0; i < slen; i++ {
|
||||
v := int8(s[i])
|
||||
b = (b * c1) + uint32(v)
|
||||
c ^= b
|
||||
}
|
||||
return fmix(mur(b, mur(uint32(slen), c)))
|
||||
}
|
||||
|
||||
func hash128to64(x uint128) uint64 {
|
||||
// Murmur-inspired hashing.
|
||||
const mul uint64 = 0x9ddfea08eb382d69
|
||||
a := (x.lo ^ x.hi) * mul
|
||||
a ^= (a >> 47)
|
||||
b := (x.hi ^ a) * mul
|
||||
b ^= (b >> 47)
|
||||
b *= mul
|
||||
return b
|
||||
}
|
||||
|
||||
type uint128 struct {
|
||||
lo uint64
|
||||
hi uint64
|
||||
}
|
||||
|
||||
// A subroutine for CityHash128(). Returns a decent 128-bit hash for strings
|
||||
// of any length representable in signed long. Based on City and Murmur.
|
||||
func cityMurmur(s []byte, seed uint128) uint128 {
|
||||
slen := len(s)
|
||||
a := seed.lo
|
||||
b := seed.hi
|
||||
var c uint64
|
||||
var d uint64
|
||||
l := slen - 16
|
||||
if l <= 0 { // len <= 16
|
||||
a = shiftMix(a*k1) * k1
|
||||
c = b*k1 + hashLen0to16(s)
|
||||
if slen >= 8 {
|
||||
d = shiftMix(a + binary.LittleEndian.Uint64(s[0:0+8]))
|
||||
} else {
|
||||
d = shiftMix(a + c)
|
||||
}
|
||||
} else { // len > 16
|
||||
c = hashLen16(binary.LittleEndian.Uint64(s[slen-8:slen-8+8])+k1, a)
|
||||
d = hashLen16(b+uint64(slen), c+binary.LittleEndian.Uint64(s[slen-16:slen-16+8]))
|
||||
a += d
|
||||
for {
|
||||
a ^= shiftMix(binary.LittleEndian.Uint64(s[0:0+8])*k1) * k1
|
||||
a *= k1
|
||||
b ^= a
|
||||
c ^= shiftMix(binary.LittleEndian.Uint64(s[8:8+8])*k1) * k1
|
||||
c *= k1
|
||||
d ^= c
|
||||
s = s[16:]
|
||||
l -= 16
|
||||
if l <= 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
a = hashLen16(a, c)
|
||||
b = hashLen16(d, b)
|
||||
return uint128{a ^ b, hashLen16(b, a)}
|
||||
}
|
||||
|
||||
func cityHash128WithSeed(s []byte, seed uint128) uint128 {
|
||||
slen := len(s)
|
||||
if slen < 128 {
|
||||
return cityMurmur(s, seed)
|
||||
}
|
||||
|
||||
endIdx := ((slen - 1) / 128) * 128
|
||||
lastBlockIdx := endIdx + ((slen - 1) & 127) - 127
|
||||
last := s[lastBlockIdx:]
|
||||
|
||||
// We expect len >= 128 to be the common case. Keep 56 bytes of state:
|
||||
// v, w, x, y, and z.
|
||||
var v1, v2 uint64
|
||||
var w1, w2 uint64
|
||||
x := seed.lo
|
||||
y := seed.hi
|
||||
z := uint64(slen) * k1
|
||||
v1 = bits.RotateLeft64(y^k1, -49)*k1 + binary.LittleEndian.Uint64(s[0:0+8])
|
||||
v2 = bits.RotateLeft64(v1, -42)*k1 + binary.LittleEndian.Uint64(s[8:8+8])
|
||||
w1 = bits.RotateLeft64(y+z, -35)*k1 + x
|
||||
w2 = bits.RotateLeft64(x+binary.LittleEndian.Uint64(s[88:88+8]), -53) * k1
|
||||
|
||||
// This is the same inner loop as CityHash64(), manually unrolled.
|
||||
for {
|
||||
x = bits.RotateLeft64(x+y+v1+binary.LittleEndian.Uint64(s[8:8+8]), -37) * k1
|
||||
y = bits.RotateLeft64(y+v2+binary.LittleEndian.Uint64(s[48:48+8]), -42) * k1
|
||||
x ^= w2
|
||||
y += v1 + binary.LittleEndian.Uint64(s[40:40+8])
|
||||
z = bits.RotateLeft64(z+w1, -33) * k1
|
||||
v1, v2 = weakHashLen32WithSeeds(s, v2*k1, x+w1)
|
||||
w1, w2 = weakHashLen32WithSeeds(s[32:], z+w2, y+binary.LittleEndian.Uint64(s[16:16+8]))
|
||||
z, x = x, z
|
||||
s = s[64:]
|
||||
x = bits.RotateLeft64(x+y+v1+binary.LittleEndian.Uint64(s[8:8+8]), -37) * k1
|
||||
y = bits.RotateLeft64(y+v2+binary.LittleEndian.Uint64(s[48:48+8]), -42) * k1
|
||||
x ^= w2
|
||||
y += v1 + binary.LittleEndian.Uint64(s[40:40+8])
|
||||
z = bits.RotateLeft64(z+w1, -33) * k1
|
||||
v1, v2 = weakHashLen32WithSeeds(s, v2*k1, x+w1)
|
||||
w1, w2 = weakHashLen32WithSeeds(s[32:], z+w2, y+binary.LittleEndian.Uint64(s[16:16+8]))
|
||||
z, x = x, z
|
||||
s = s[64:]
|
||||
slen -= 128
|
||||
if slen < 128 {
|
||||
break
|
||||
}
|
||||
}
|
||||
x += bits.RotateLeft64(v1+z, -49) * k0
|
||||
y = y*k0 + bits.RotateLeft64(w2, -37)
|
||||
z = z*k0 + bits.RotateLeft64(w1, -27)
|
||||
w1 *= 9
|
||||
v1 *= k0
|
||||
// If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s.
|
||||
for tailDone := 0; tailDone < slen; {
|
||||
tailDone += 32
|
||||
y = bits.RotateLeft64(x+y, -42)*k0 + v2
|
||||
w1 += binary.LittleEndian.Uint64(last[128-tailDone+16 : 128-tailDone+16+8])
|
||||
x = x*k0 + w1
|
||||
z += w2 + binary.LittleEndian.Uint64(last[128-tailDone:128-tailDone+8])
|
||||
w2 += v1
|
||||
v1, v2 = weakHashLen32WithSeeds(last[128-tailDone:], v1+z, v2)
|
||||
v1 *= k0
|
||||
}
|
||||
|
||||
// At this point our 56 bytes of state should contain more than
|
||||
// enough information for a strong 128-bit hash. We use two
|
||||
// different 56-byte-to-8-byte hashes to get a 16-byte final result.
|
||||
x = hashLen16(x, v1)
|
||||
y = hashLen16(y+z, w1)
|
||||
return uint128{hashLen16(x+v2, w2) + y,
|
||||
hashLen16(x+w2, y+v2)}
|
||||
}
|
||||
|
||||
func cityHash128(s []byte) uint128 {
|
||||
slen := len(s)
|
||||
if slen >= 16 {
|
||||
return cityHash128WithSeed(s[16:], uint128{binary.LittleEndian.Uint64(s[0 : 0+8]), binary.LittleEndian.Uint64(s[8:8+8]) + k0})
|
||||
}
|
||||
return cityHash128WithSeed(s, uint128{k0, k1})
|
||||
}
|
||||
|
||||
// Fingerprint128 is a 128-bit fingerprint function for byte-slices
|
||||
func Fingerprint128(s []byte) (lo, hi uint64) {
|
||||
h := cityHash128(s)
|
||||
return h.lo, h.hi
|
||||
}
|
||||
|
||||
// Hash128 is a 128-bit hash function for byte-slices
|
||||
func Hash128(s []byte) (lo, hi uint64) {
|
||||
return Fingerprint128(s)
|
||||
}
|
||||
|
||||
// Hash128WithSeed is a 128-bit hash function for byte-slices and a 128-bit seed
|
||||
func Hash128WithSeed(s []byte, seed0, seed1 uint64) (lo, hi uint64) {
|
||||
h := cityHash128WithSeed(s, uint128{seed0, seed1})
|
||||
return h.lo, h.hi
|
||||
}
|
||||
102
vendor/github.com/dgryski/go-farm/farmhashmk.go
generated
vendored
Normal file
102
vendor/github.com/dgryski/go-farm/farmhashmk.go
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
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 += 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))))
|
||||
}
|
||||
|
||||
// Hash32 hashes a byte slice and returns a uint32 hash value
|
||||
func Hash32(s []byte) uint32 {
|
||||
|
||||
slen := len(s)
|
||||
|
||||
if slen <= 24 {
|
||||
if slen <= 12 {
|
||||
if slen <= 4 {
|
||||
return hash32Len0to4(s, 0)
|
||||
}
|
||||
return hash32Len5to12(s, 0)
|
||||
}
|
||||
return hash32Len13to24Seed(s, 0)
|
||||
}
|
||||
|
||||
// len > 24
|
||||
h := uint32(slen)
|
||||
g := c1 * uint32(slen)
|
||||
f := g
|
||||
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 = bits.RotateLeft32(h, -19)
|
||||
h = h*5 + 0xe6546b64
|
||||
h ^= a2
|
||||
h = bits.RotateLeft32(h, -19)
|
||||
h = h*5 + 0xe6546b64
|
||||
g ^= a1
|
||||
g = bits.RotateLeft32(g, -19)
|
||||
g = g*5 + 0xe6546b64
|
||||
g ^= a3
|
||||
g = bits.RotateLeft32(g, -19)
|
||||
g = g*5 + 0xe6546b64
|
||||
f += a4
|
||||
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
|
||||
h = mur(d, h) + e
|
||||
g = mur(c, g) + a
|
||||
f = mur(b+e*c1, f) + d
|
||||
f += g
|
||||
g += f
|
||||
s = s[20:]
|
||||
}
|
||||
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 = bits.RotateLeft32(h, -17) * c1
|
||||
h = bits.RotateLeft32(h+f, -19)
|
||||
h = h*5 + 0xe6546b64
|
||||
h = bits.RotateLeft32(h, -17) * c1
|
||||
return h
|
||||
}
|
||||
|
||||
// Hash32WithSeed hashes a byte slice and a uint32 seed and returns a uint32 hash value
|
||||
func Hash32WithSeed(s []byte, seed uint32) uint32 {
|
||||
slen := len(s)
|
||||
|
||||
if slen <= 24 {
|
||||
if slen >= 13 {
|
||||
return hash32Len13to24Seed(s, seed*c1)
|
||||
}
|
||||
if slen >= 5 {
|
||||
return hash32Len5to12(s, seed)
|
||||
}
|
||||
return hash32Len0to4(s, seed)
|
||||
}
|
||||
h := hash32Len13to24Seed(s[:24], seed^uint32(slen))
|
||||
return mur(Hash32(s[24:])+seed, h)
|
||||
}
|
||||
161
vendor/github.com/dgryski/go-farm/farmhashna.go
generated
vendored
Normal file
161
vendor/github.com/dgryski/go-farm/farmhashna.go
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
package farm
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math/bits"
|
||||
)
|
||||
|
||||
func shiftMix(val uint64) uint64 {
|
||||
return val ^ (val >> 47)
|
||||
}
|
||||
|
||||
func hashLen16(u, v uint64) uint64 {
|
||||
return hash128to64(uint128{u, v})
|
||||
}
|
||||
|
||||
func hashLen16Mul(u, v, mul uint64) uint64 {
|
||||
// Murmur-inspired hashing.
|
||||
a := (u ^ v) * mul
|
||||
a ^= (a >> 47)
|
||||
b := (v ^ a) * mul
|
||||
b ^= (b >> 47)
|
||||
b *= mul
|
||||
return b
|
||||
}
|
||||
|
||||
func hashLen0to16(s []byte) uint64 {
|
||||
slen := uint64(len(s))
|
||||
if slen >= 8 {
|
||||
mul := k2 + slen*2
|
||||
a := binary.LittleEndian.Uint64(s[0:0+8]) + k2
|
||||
b := binary.LittleEndian.Uint64(s[int(slen-8) : int(slen-8)+8])
|
||||
c := bits.RotateLeft64(b, -37)*mul + a
|
||||
d := (bits.RotateLeft64(a, -25) + b) * mul
|
||||
return hashLen16Mul(c, d, mul)
|
||||
}
|
||||
|
||||
if slen >= 4 {
|
||||
mul := k2 + slen*2
|
||||
a := binary.LittleEndian.Uint32(s[0 : 0+4])
|
||||
return hashLen16Mul(slen+(uint64(a)<<3), uint64(binary.LittleEndian.Uint32(s[int(slen-4):int(slen-4)+4])), mul)
|
||||
}
|
||||
if slen > 0 {
|
||||
a := s[0]
|
||||
b := s[slen>>1]
|
||||
c := s[slen-1]
|
||||
y := uint32(a) + (uint32(b) << 8)
|
||||
z := uint32(slen) + (uint32(c) << 2)
|
||||
return shiftMix(uint64(y)*k2^uint64(z)*k0) * k2
|
||||
}
|
||||
return k2
|
||||
}
|
||||
|
||||
// This probably works well for 16-byte strings as well, but it may be overkill
|
||||
// in that case.
|
||||
func hashLen17to32(s []byte) uint64 {
|
||||
slen := len(s)
|
||||
mul := k2 + uint64(slen*2)
|
||||
a := binary.LittleEndian.Uint64(s[0:0+8]) * k1
|
||||
b := binary.LittleEndian.Uint64(s[8 : 8+8])
|
||||
c := binary.LittleEndian.Uint64(s[slen-8:slen-8+8]) * mul
|
||||
d := binary.LittleEndian.Uint64(s[slen-16:slen-16+8]) * k2
|
||||
return hashLen16Mul(bits.RotateLeft64(a+b, -43)+bits.RotateLeft64(c, -30)+d, a+bits.RotateLeft64(b+k2, -18)+c, mul)
|
||||
}
|
||||
|
||||
// Return a 16-byte hash for 48 bytes. Quick and dirty.
|
||||
// Callers do best to use "random-looking" values for a and b.
|
||||
func weakHashLen32WithSeedsWords(w, x, y, z, a, b uint64) (uint64, uint64) {
|
||||
a += w
|
||||
b = bits.RotateLeft64(b+a+z, -21)
|
||||
c := a
|
||||
a += x
|
||||
a += y
|
||||
b += bits.RotateLeft64(a, -44)
|
||||
return a + z, b + c
|
||||
}
|
||||
|
||||
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
|
||||
func weakHashLen32WithSeeds(s []byte, a, b uint64) (uint64, uint64) {
|
||||
return weakHashLen32WithSeedsWords(binary.LittleEndian.Uint64(s[0:0+8]),
|
||||
binary.LittleEndian.Uint64(s[8:8+8]),
|
||||
binary.LittleEndian.Uint64(s[16:16+8]),
|
||||
binary.LittleEndian.Uint64(s[24:24+8]),
|
||||
a,
|
||||
b)
|
||||
}
|
||||
|
||||
// Return an 8-byte hash for 33 to 64 bytes.
|
||||
func hashLen33to64(s []byte) uint64 {
|
||||
slen := len(s)
|
||||
mul := k2 + uint64(slen)*2
|
||||
a := binary.LittleEndian.Uint64(s[0:0+8]) * k2
|
||||
b := binary.LittleEndian.Uint64(s[8 : 8+8])
|
||||
c := binary.LittleEndian.Uint64(s[slen-8:slen-8+8]) * mul
|
||||
d := binary.LittleEndian.Uint64(s[slen-16:slen-16+8]) * k2
|
||||
y := bits.RotateLeft64(a+b, -43) + bits.RotateLeft64(c, -30) + d
|
||||
z := hashLen16Mul(y, a+bits.RotateLeft64(b+k2, -18)+c, mul)
|
||||
e := binary.LittleEndian.Uint64(s[16:16+8]) * mul
|
||||
f := binary.LittleEndian.Uint64(s[24 : 24+8])
|
||||
g := (y + binary.LittleEndian.Uint64(s[slen-32:slen-32+8])) * mul
|
||||
h := (z + binary.LittleEndian.Uint64(s[slen-24:slen-24+8])) * mul
|
||||
return hashLen16Mul(bits.RotateLeft64(e+f, -43)+bits.RotateLeft64(g, -30)+h, e+bits.RotateLeft64(f+a, -18)+g, mul)
|
||||
}
|
||||
|
||||
func naHash64(s []byte) uint64 {
|
||||
slen := len(s)
|
||||
var seed uint64 = 81
|
||||
if slen <= 32 {
|
||||
if slen <= 16 {
|
||||
return hashLen0to16(s)
|
||||
}
|
||||
return hashLen17to32(s)
|
||||
}
|
||||
if slen <= 64 {
|
||||
return hashLen33to64(s)
|
||||
}
|
||||
// For strings over 64 bytes we loop.
|
||||
// Internal state consists of 56 bytes: v, w, x, y, and z.
|
||||
v := uint128{0, 0}
|
||||
w := uint128{0, 0}
|
||||
x := seed*k2 + binary.LittleEndian.Uint64(s[0:0+8])
|
||||
y := seed*k1 + 113
|
||||
z := shiftMix(y*k2+113) * k2
|
||||
// Set end so that after the loop we have 1 to 64 bytes left to process.
|
||||
endIdx := ((slen - 1) / 64) * 64
|
||||
last64Idx := endIdx + ((slen - 1) & 63) - 63
|
||||
last64 := s[last64Idx:]
|
||||
for len(s) > 64 {
|
||||
x = bits.RotateLeft64(x+y+v.lo+binary.LittleEndian.Uint64(s[8:8+8]), -37) * k1
|
||||
y = bits.RotateLeft64(y+v.hi+binary.LittleEndian.Uint64(s[48:48+8]), -42) * k1
|
||||
x ^= w.hi
|
||||
y += v.lo + binary.LittleEndian.Uint64(s[40:40+8])
|
||||
z = bits.RotateLeft64(z+w.lo, -33) * k1
|
||||
v.lo, v.hi = weakHashLen32WithSeeds(s, v.hi*k1, x+w.lo)
|
||||
w.lo, w.hi = weakHashLen32WithSeeds(s[32:], z+w.hi, y+binary.LittleEndian.Uint64(s[16:16+8]))
|
||||
x, z = z, x
|
||||
s = s[64:]
|
||||
}
|
||||
mul := k1 + ((z & 0xff) << 1)
|
||||
// Make s point to the last 64 bytes of input.
|
||||
s = last64
|
||||
w.lo += (uint64(slen-1) & 63)
|
||||
v.lo += w.lo
|
||||
w.lo += v.lo
|
||||
x = bits.RotateLeft64(x+y+v.lo+binary.LittleEndian.Uint64(s[8:8+8]), -37) * mul
|
||||
y = bits.RotateLeft64(y+v.hi+binary.LittleEndian.Uint64(s[48:48+8]), -42) * mul
|
||||
x ^= w.hi * 9
|
||||
y += v.lo*9 + binary.LittleEndian.Uint64(s[40:40+8])
|
||||
z = bits.RotateLeft64(z+w.lo, -33) * mul
|
||||
v.lo, v.hi = weakHashLen32WithSeeds(s, v.hi*mul, x+w.lo)
|
||||
w.lo, w.hi = weakHashLen32WithSeeds(s[32:], z+w.hi, y+binary.LittleEndian.Uint64(s[16:16+8]))
|
||||
x, z = z, x
|
||||
return hashLen16Mul(hashLen16Mul(v.lo, w.lo, mul)+shiftMix(y)*k0+z, hashLen16Mul(v.hi, w.hi, mul)+x, mul)
|
||||
}
|
||||
|
||||
func naHash64WithSeed(s []byte, seed uint64) uint64 {
|
||||
return naHash64WithSeeds(s, k2, seed)
|
||||
}
|
||||
|
||||
func naHash64WithSeeds(s []byte, seed0, seed1 uint64) uint64 {
|
||||
return hashLen16(naHash64(s)-seed0, seed1)
|
||||
}
|
||||
122
vendor/github.com/dgryski/go-farm/farmhashuo.go
generated
vendored
Normal file
122
vendor/github.com/dgryski/go-farm/farmhashuo.go
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
package farm
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math/bits"
|
||||
)
|
||||
|
||||
func uoH(x, y, mul uint64, r uint) uint64 {
|
||||
a := (x ^ y) * mul
|
||||
a ^= (a >> 47)
|
||||
b := (y ^ a) * mul
|
||||
return bits.RotateLeft64(b, -int(r)) * mul
|
||||
}
|
||||
|
||||
// Hash64WithSeeds hashes a byte slice and two uint64 seeds and returns a uint64 hash value
|
||||
func Hash64WithSeeds(s []byte, seed0, seed1 uint64) uint64 {
|
||||
slen := len(s)
|
||||
if slen <= 64 {
|
||||
return naHash64WithSeeds(s, seed0, seed1)
|
||||
}
|
||||
|
||||
// For strings over 64 bytes we loop.
|
||||
// Internal state consists of 64 bytes: u, v, w, x, y, and z.
|
||||
x := seed0
|
||||
y := seed1*k2 + 113
|
||||
z := shiftMix(y*k2) * k2
|
||||
v := uint128{seed0, seed1}
|
||||
var w uint128
|
||||
u := x - z
|
||||
x *= k2
|
||||
mul := k2 + (u & 0x82)
|
||||
|
||||
// Set end so that after the loop we have 1 to 64 bytes left to process.
|
||||
endIdx := ((slen - 1) / 64) * 64
|
||||
last64Idx := endIdx + ((slen - 1) & 63) - 63
|
||||
last64 := s[last64Idx:]
|
||||
|
||||
for len(s) > 64 {
|
||||
a0 := binary.LittleEndian.Uint64(s[0 : 0+8])
|
||||
a1 := binary.LittleEndian.Uint64(s[8 : 8+8])
|
||||
a2 := binary.LittleEndian.Uint64(s[16 : 16+8])
|
||||
a3 := binary.LittleEndian.Uint64(s[24 : 24+8])
|
||||
a4 := binary.LittleEndian.Uint64(s[32 : 32+8])
|
||||
a5 := binary.LittleEndian.Uint64(s[40 : 40+8])
|
||||
a6 := binary.LittleEndian.Uint64(s[48 : 48+8])
|
||||
a7 := binary.LittleEndian.Uint64(s[56 : 56+8])
|
||||
x += a0 + a1
|
||||
y += a2
|
||||
z += a3
|
||||
v.lo += a4
|
||||
v.hi += a5 + a1
|
||||
w.lo += a6
|
||||
w.hi += a7
|
||||
|
||||
x = bits.RotateLeft64(x, -26)
|
||||
x *= 9
|
||||
y = bits.RotateLeft64(y, -29)
|
||||
z *= mul
|
||||
v.lo = bits.RotateLeft64(v.lo, -33)
|
||||
v.hi = bits.RotateLeft64(v.hi, -30)
|
||||
w.lo ^= x
|
||||
w.lo *= 9
|
||||
z = bits.RotateLeft64(z, -32)
|
||||
z += w.hi
|
||||
w.hi += z
|
||||
z *= 9
|
||||
u, y = y, u
|
||||
|
||||
z += a0 + a6
|
||||
v.lo += a2
|
||||
v.hi += a3
|
||||
w.lo += a4
|
||||
w.hi += a5 + a6
|
||||
x += a1
|
||||
y += a7
|
||||
|
||||
y += v.lo
|
||||
v.lo += x - y
|
||||
v.hi += w.lo
|
||||
w.lo += v.hi
|
||||
w.hi += x - y
|
||||
x += w.hi
|
||||
w.hi = bits.RotateLeft64(w.hi, -34)
|
||||
u, z = z, u
|
||||
s = s[64:]
|
||||
}
|
||||
// Make s point to the last 64 bytes of input.
|
||||
s = last64
|
||||
u *= 9
|
||||
v.hi = bits.RotateLeft64(v.hi, -28)
|
||||
v.lo = bits.RotateLeft64(v.lo, -20)
|
||||
w.lo += (uint64(slen-1) & 63)
|
||||
u += y
|
||||
y += u
|
||||
x = bits.RotateLeft64(y-x+v.lo+binary.LittleEndian.Uint64(s[8:8+8]), -37) * mul
|
||||
y = bits.RotateLeft64(y^v.hi^binary.LittleEndian.Uint64(s[48:48+8]), -42) * mul
|
||||
x ^= w.hi * 9
|
||||
y += v.lo + binary.LittleEndian.Uint64(s[40:40+8])
|
||||
z = bits.RotateLeft64(z+w.lo, -33) * mul
|
||||
v.lo, v.hi = weakHashLen32WithSeeds(s, v.hi*mul, x+w.lo)
|
||||
w.lo, w.hi = weakHashLen32WithSeeds(s[32:], z+w.hi, y+binary.LittleEndian.Uint64(s[16:16+8]))
|
||||
return uoH(hashLen16Mul(v.lo+x, w.lo^y, mul)+z-u,
|
||||
uoH(v.hi+y, w.hi+z, k2, 30)^x,
|
||||
k2,
|
||||
31)
|
||||
}
|
||||
|
||||
// Hash64WithSeed hashes a byte slice and a uint64 seed and returns a uint64 hash value
|
||||
func Hash64WithSeed(s []byte, seed uint64) uint64 {
|
||||
if len(s) <= 64 {
|
||||
return naHash64WithSeed(s, seed)
|
||||
}
|
||||
return Hash64WithSeeds(s, 0, seed)
|
||||
}
|
||||
|
||||
// Hash64 hashes a byte slice and returns a uint64 hash value
|
||||
func Hash64(s []byte) uint64 {
|
||||
if len(s) <= 64 {
|
||||
return naHash64(s)
|
||||
}
|
||||
return Hash64WithSeeds(s, 81, 0)
|
||||
}
|
||||
951
vendor/github.com/dgryski/go-farm/fp_amd64.s
generated
vendored
Normal file
951
vendor/github.com/dgryski/go-farm/fp_amd64.s
generated
vendored
Normal file
@@ -0,0 +1,951 @@
|
||||
// Code generated by command: go run asm.go -out=fp_amd64.s -go111=false. DO NOT EDIT.
|
||||
|
||||
// +build amd64,!purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func Fingerprint64(s []byte) uint64
|
||||
TEXT ·Fingerprint64(SB), NOSPLIT, $0-32
|
||||
MOVQ s_base+0(FP), CX
|
||||
MOVQ s_len+8(FP), AX
|
||||
CMPQ AX, $0x10
|
||||
JG check32
|
||||
CMPQ AX, $0x08
|
||||
JL check4
|
||||
MOVQ (CX), DX
|
||||
MOVQ AX, BX
|
||||
SUBQ $0x08, BX
|
||||
ADDQ CX, BX
|
||||
MOVQ (BX), BX
|
||||
MOVQ $0x9ae16a3b2f90404f, BP
|
||||
ADDQ BP, DX
|
||||
SHLQ $0x01, AX
|
||||
ADDQ BP, AX
|
||||
MOVQ BX, BP
|
||||
RORQ $0x25, BP
|
||||
IMULQ AX, BP
|
||||
ADDQ DX, BP
|
||||
RORQ $0x19, DX
|
||||
ADDQ BX, DX
|
||||
IMULQ AX, DX
|
||||
XORQ DX, BP
|
||||
IMULQ AX, BP
|
||||
MOVQ BP, BX
|
||||
SHRQ $0x2f, BX
|
||||
XORQ BP, BX
|
||||
XORQ BX, DX
|
||||
IMULQ AX, DX
|
||||
MOVQ DX, BX
|
||||
SHRQ $0x2f, BX
|
||||
XORQ DX, BX
|
||||
IMULQ AX, BX
|
||||
MOVQ BX, ret+24(FP)
|
||||
RET
|
||||
|
||||
check4:
|
||||
CMPQ AX, $0x04
|
||||
JL check0
|
||||
MOVQ $0x9ae16a3b2f90404f, DX
|
||||
MOVQ AX, BX
|
||||
SHLQ $0x01, BX
|
||||
ADDQ DX, BX
|
||||
MOVL (CX), SI
|
||||
SHLQ $0x03, SI
|
||||
ADDQ AX, SI
|
||||
SUBQ $0x04, AX
|
||||
ADDQ AX, CX
|
||||
MOVL (CX), DI
|
||||
XORQ DI, SI
|
||||
IMULQ BX, SI
|
||||
MOVQ SI, DX
|
||||
SHRQ $0x2f, DX
|
||||
XORQ SI, DX
|
||||
XORQ DX, DI
|
||||
IMULQ BX, DI
|
||||
MOVQ DI, DX
|
||||
SHRQ $0x2f, DX
|
||||
XORQ DI, DX
|
||||
IMULQ BX, DX
|
||||
MOVQ DX, ret+24(FP)
|
||||
RET
|
||||
|
||||
check0:
|
||||
TESTQ AX, AX
|
||||
JZ empty
|
||||
MOVBQZX (CX), DX
|
||||
MOVQ AX, BX
|
||||
SHRQ $0x01, BX
|
||||
ADDQ CX, BX
|
||||
MOVBQZX (BX), BP
|
||||
MOVQ AX, BX
|
||||
SUBQ $0x01, BX
|
||||
ADDQ CX, BX
|
||||
MOVBQZX (BX), BX
|
||||
SHLQ $0x08, BP
|
||||
ADDQ BP, DX
|
||||
SHLQ $0x02, BX
|
||||
ADDQ BX, AX
|
||||
MOVQ $0xc3a5c85c97cb3127, BX
|
||||
IMULQ BX, AX
|
||||
MOVQ $0x9ae16a3b2f90404f, BX
|
||||
IMULQ BX, DX
|
||||
XORQ DX, AX
|
||||
MOVQ AX, DX
|
||||
SHRQ $0x2f, DX
|
||||
XORQ AX, DX
|
||||
IMULQ BX, DX
|
||||
MOVQ DX, ret+24(FP)
|
||||
RET
|
||||
|
||||
empty:
|
||||
MOVQ $0x9ae16a3b2f90404f, DX
|
||||
MOVQ DX, ret+24(FP)
|
||||
RET
|
||||
|
||||
check32:
|
||||
CMPQ AX, $0x20
|
||||
JG check64
|
||||
MOVQ AX, DX
|
||||
SHLQ $0x01, DX
|
||||
MOVQ $0x9ae16a3b2f90404f, BX
|
||||
ADDQ BX, DX
|
||||
MOVQ (CX), BP
|
||||
MOVQ $0xb492b66fbe98f273, SI
|
||||
IMULQ SI, BP
|
||||
MOVQ 8(CX), SI
|
||||
MOVQ AX, DI
|
||||
SUBQ $0x10, DI
|
||||
ADDQ CX, DI
|
||||
MOVQ 8(DI), R12
|
||||
IMULQ DX, R12
|
||||
MOVQ (DI), DI
|
||||
IMULQ BX, DI
|
||||
MOVQ BP, R13
|
||||
ADDQ SI, R13
|
||||
RORQ $0x2b, R13
|
||||
ADDQ DI, R13
|
||||
MOVQ R12, DI
|
||||
RORQ $0x1e, DI
|
||||
ADDQ DI, R13
|
||||
ADDQ R12, BP
|
||||
ADDQ BX, SI
|
||||
RORQ $0x12, SI
|
||||
ADDQ SI, BP
|
||||
XORQ BP, R13
|
||||
IMULQ DX, R13
|
||||
MOVQ R13, BX
|
||||
SHRQ $0x2f, BX
|
||||
XORQ R13, BX
|
||||
XORQ BX, BP
|
||||
IMULQ DX, BP
|
||||
MOVQ BP, BX
|
||||
SHRQ $0x2f, BX
|
||||
XORQ BP, BX
|
||||
IMULQ DX, BX
|
||||
MOVQ BX, ret+24(FP)
|
||||
RET
|
||||
|
||||
check64:
|
||||
CMPQ AX, $0x40
|
||||
JG long
|
||||
MOVQ AX, DX
|
||||
SHLQ $0x01, DX
|
||||
MOVQ $0x9ae16a3b2f90404f, BX
|
||||
ADDQ BX, DX
|
||||
MOVQ (CX), BP
|
||||
IMULQ BX, BP
|
||||
MOVQ 8(CX), SI
|
||||
MOVQ AX, DI
|
||||
SUBQ $0x10, DI
|
||||
ADDQ CX, DI
|
||||
MOVQ 8(DI), R12
|
||||
IMULQ DX, R12
|
||||
MOVQ (DI), DI
|
||||
IMULQ BX, DI
|
||||
MOVQ BP, R13
|
||||
ADDQ SI, R13
|
||||
RORQ $0x2b, R13
|
||||
ADDQ DI, R13
|
||||
MOVQ R12, DI
|
||||
RORQ $0x1e, DI
|
||||
ADDQ DI, R13
|
||||
ADDQ BP, R12
|
||||
ADDQ BX, SI
|
||||
RORQ $0x12, SI
|
||||
ADDQ SI, R12
|
||||
MOVQ R13, BX
|
||||
XORQ R12, BX
|
||||
IMULQ DX, BX
|
||||
MOVQ BX, SI
|
||||
SHRQ $0x2f, SI
|
||||
XORQ BX, SI
|
||||
XORQ SI, R12
|
||||
IMULQ DX, R12
|
||||
MOVQ R12, BX
|
||||
SHRQ $0x2f, BX
|
||||
XORQ R12, BX
|
||||
IMULQ DX, BX
|
||||
MOVQ 16(CX), SI
|
||||
IMULQ DX, SI
|
||||
MOVQ 24(CX), DI
|
||||
MOVQ AX, R12
|
||||
SUBQ $0x20, R12
|
||||
ADDQ CX, R12
|
||||
MOVQ (R12), R14
|
||||
ADDQ R13, R14
|
||||
IMULQ DX, R14
|
||||
MOVQ 8(R12), R12
|
||||
ADDQ BX, R12
|
||||
IMULQ DX, R12
|
||||
MOVQ SI, BX
|
||||
ADDQ DI, BX
|
||||
RORQ $0x2b, BX
|
||||
ADDQ R12, BX
|
||||
MOVQ R14, R12
|
||||
RORQ $0x1e, R12
|
||||
ADDQ R12, BX
|
||||
ADDQ R14, SI
|
||||
ADDQ BP, DI
|
||||
RORQ $0x12, DI
|
||||
ADDQ DI, SI
|
||||
XORQ SI, BX
|
||||
IMULQ DX, BX
|
||||
MOVQ BX, BP
|
||||
SHRQ $0x2f, BP
|
||||
XORQ BX, BP
|
||||
XORQ BP, SI
|
||||
IMULQ DX, SI
|
||||
MOVQ SI, BX
|
||||
SHRQ $0x2f, BX
|
||||
XORQ SI, BX
|
||||
IMULQ DX, BX
|
||||
MOVQ BX, ret+24(FP)
|
||||
RET
|
||||
|
||||
long:
|
||||
XORQ R8, R8
|
||||
XORQ R9, R9
|
||||
XORQ R10, R10
|
||||
XORQ R11, R11
|
||||
MOVQ $0x01529cba0ca458ff, DX
|
||||
ADDQ (CX), DX
|
||||
MOVQ $0x226bb95b4e64b6d4, BX
|
||||
MOVQ $0x134a747f856d0526, BP
|
||||
MOVQ AX, SI
|
||||
SUBQ $0x01, SI
|
||||
MOVQ $0xffffffffffffffc0, DI
|
||||
ANDQ DI, SI
|
||||
MOVQ AX, DI
|
||||
SUBQ $0x01, DI
|
||||
ANDQ $0x3f, DI
|
||||
SUBQ $0x3f, DI
|
||||
ADDQ SI, DI
|
||||
MOVQ DI, SI
|
||||
ADDQ CX, SI
|
||||
MOVQ AX, DI
|
||||
|
||||
loop:
|
||||
MOVQ $0xb492b66fbe98f273, R12
|
||||
ADDQ BX, DX
|
||||
ADDQ R8, DX
|
||||
ADDQ 8(CX), DX
|
||||
RORQ $0x25, DX
|
||||
IMULQ R12, DX
|
||||
ADDQ R9, BX
|
||||
ADDQ 48(CX), BX
|
||||
RORQ $0x2a, BX
|
||||
IMULQ R12, BX
|
||||
XORQ R11, DX
|
||||
ADDQ R8, BX
|
||||
ADDQ 40(CX), BX
|
||||
ADDQ R10, BP
|
||||
RORQ $0x21, BP
|
||||
IMULQ R12, BP
|
||||
IMULQ R12, R9
|
||||
MOVQ DX, R8
|
||||
ADDQ R10, R8
|
||||
ADDQ (CX), R9
|
||||
ADDQ R9, R8
|
||||
ADDQ 24(CX), R8
|
||||
RORQ $0x15, R8
|
||||
MOVQ R9, R10
|
||||
ADDQ 8(CX), R9
|
||||
ADDQ 16(CX), R9
|
||||
MOVQ R9, R13
|
||||
RORQ $0x2c, R13
|
||||
ADDQ R13, R8
|
||||
ADDQ 24(CX), R9
|
||||
ADDQ R10, R8
|
||||
XCHGQ R9, R8
|
||||
ADDQ BP, R11
|
||||
MOVQ BX, R10
|
||||
ADDQ 16(CX), R10
|
||||
ADDQ 32(CX), R11
|
||||
ADDQ R11, R10
|
||||
ADDQ 56(CX), R10
|
||||
RORQ $0x15, R10
|
||||
MOVQ R11, R13
|
||||
ADDQ 40(CX), R11
|
||||
ADDQ 48(CX), R11
|
||||
MOVQ R11, R14
|
||||
RORQ $0x2c, R14
|
||||
ADDQ R14, R10
|
||||
ADDQ 56(CX), R11
|
||||
ADDQ R13, R10
|
||||
XCHGQ R11, R10
|
||||
XCHGQ BP, DX
|
||||
ADDQ $0x40, CX
|
||||
SUBQ $0x40, DI
|
||||
CMPQ DI, $0x40
|
||||
JG loop
|
||||
MOVQ SI, CX
|
||||
MOVQ BP, DI
|
||||
ANDQ $0xff, DI
|
||||
SHLQ $0x01, DI
|
||||
ADDQ R12, DI
|
||||
MOVQ SI, CX
|
||||
SUBQ $0x01, AX
|
||||
ANDQ $0x3f, AX
|
||||
ADDQ AX, R10
|
||||
ADDQ R10, R8
|
||||
ADDQ R8, R10
|
||||
ADDQ BX, DX
|
||||
ADDQ R8, DX
|
||||
ADDQ 8(CX), DX
|
||||
RORQ $0x25, DX
|
||||
IMULQ DI, DX
|
||||
ADDQ R9, BX
|
||||
ADDQ 48(CX), BX
|
||||
RORQ $0x2a, BX
|
||||
IMULQ DI, BX
|
||||
MOVQ $0x00000009, AX
|
||||
IMULQ R11, AX
|
||||
XORQ AX, DX
|
||||
MOVQ $0x00000009, AX
|
||||
IMULQ R8, AX
|
||||
ADDQ AX, BX
|
||||
ADDQ 40(CX), BX
|
||||
ADDQ R10, BP
|
||||
RORQ $0x21, BP
|
||||
IMULQ DI, BP
|
||||
IMULQ DI, R9
|
||||
MOVQ DX, R8
|
||||
ADDQ R10, R8
|
||||
ADDQ (CX), R9
|
||||
ADDQ R9, R8
|
||||
ADDQ 24(CX), R8
|
||||
RORQ $0x15, R8
|
||||
MOVQ R9, AX
|
||||
ADDQ 8(CX), R9
|
||||
ADDQ 16(CX), R9
|
||||
MOVQ R9, SI
|
||||
RORQ $0x2c, SI
|
||||
ADDQ SI, R8
|
||||
ADDQ 24(CX), R9
|
||||
ADDQ AX, R8
|
||||
XCHGQ R9, R8
|
||||
ADDQ BP, R11
|
||||
MOVQ BX, R10
|
||||
ADDQ 16(CX), R10
|
||||
ADDQ 32(CX), R11
|
||||
ADDQ R11, R10
|
||||
ADDQ 56(CX), R10
|
||||
RORQ $0x15, R10
|
||||
MOVQ R11, AX
|
||||
ADDQ 40(CX), R11
|
||||
ADDQ 48(CX), R11
|
||||
MOVQ R11, SI
|
||||
RORQ $0x2c, SI
|
||||
ADDQ SI, R10
|
||||
ADDQ 56(CX), R11
|
||||
ADDQ AX, R10
|
||||
XCHGQ R11, R10
|
||||
XCHGQ BP, DX
|
||||
XORQ R10, R8
|
||||
IMULQ DI, R8
|
||||
MOVQ R8, AX
|
||||
SHRQ $0x2f, AX
|
||||
XORQ R8, AX
|
||||
XORQ AX, R10
|
||||
IMULQ DI, R10
|
||||
MOVQ R10, AX
|
||||
SHRQ $0x2f, AX
|
||||
XORQ R10, AX
|
||||
IMULQ DI, AX
|
||||
ADDQ BP, AX
|
||||
MOVQ BX, CX
|
||||
SHRQ $0x2f, CX
|
||||
XORQ BX, CX
|
||||
MOVQ $0xc3a5c85c97cb3127, BX
|
||||
IMULQ BX, CX
|
||||
ADDQ CX, AX
|
||||
XORQ R11, R9
|
||||
IMULQ DI, R9
|
||||
MOVQ R9, CX
|
||||
SHRQ $0x2f, CX
|
||||
XORQ R9, CX
|
||||
XORQ CX, R11
|
||||
IMULQ DI, R11
|
||||
MOVQ R11, CX
|
||||
SHRQ $0x2f, CX
|
||||
XORQ R11, CX
|
||||
IMULQ DI, CX
|
||||
ADDQ DX, CX
|
||||
XORQ CX, AX
|
||||
IMULQ DI, AX
|
||||
MOVQ AX, DX
|
||||
SHRQ $0x2f, DX
|
||||
XORQ AX, DX
|
||||
XORQ DX, CX
|
||||
IMULQ DI, CX
|
||||
MOVQ CX, AX
|
||||
SHRQ $0x2f, AX
|
||||
XORQ CX, AX
|
||||
IMULQ DI, AX
|
||||
MOVQ AX, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func Fingerprint32(s []byte) uint32
|
||||
TEXT ·Fingerprint32(SB), NOSPLIT, $0-28
|
||||
MOVQ s_base+0(FP), AX
|
||||
MOVQ s_len+8(FP), CX
|
||||
CMPQ CX, $0x18
|
||||
JG long
|
||||
CMPQ CX, $0x0c
|
||||
JG hash_13_24
|
||||
CMPQ CX, $0x04
|
||||
JG hash_5_12
|
||||
XORL DX, DX
|
||||
MOVL $0x00000009, BX
|
||||
TESTQ CX, CX
|
||||
JZ done
|
||||
MOVQ CX, BP
|
||||
MOVL $0xcc9e2d51, DI
|
||||
IMULL DI, DX
|
||||
MOVBLSX (AX), SI
|
||||
ADDL SI, DX
|
||||
XORL DX, BX
|
||||
SUBQ $0x01, BP
|
||||
TESTQ BP, BP
|
||||
JZ done
|
||||
IMULL DI, DX
|
||||
MOVBLSX 1(AX), SI
|
||||
ADDL SI, DX
|
||||
XORL DX, BX
|
||||
SUBQ $0x01, BP
|
||||
TESTQ BP, BP
|
||||
JZ done
|
||||
IMULL DI, DX
|
||||
MOVBLSX 2(AX), SI
|
||||
ADDL SI, DX
|
||||
XORL DX, BX
|
||||
SUBQ $0x01, BP
|
||||
TESTQ BP, BP
|
||||
JZ done
|
||||
IMULL DI, DX
|
||||
MOVBLSX 3(AX), SI
|
||||
ADDL SI, DX
|
||||
XORL DX, BX
|
||||
SUBQ $0x01, BP
|
||||
TESTQ BP, BP
|
||||
JZ done
|
||||
|
||||
done:
|
||||
MOVL CX, BP
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, BP
|
||||
RORL $0x11, BP
|
||||
MOVL $0x1b873593, SI
|
||||
IMULL SI, BP
|
||||
XORL BP, BX
|
||||
RORL $0x13, BX
|
||||
LEAL (BX)(BX*4), BP
|
||||
LEAL 3864292196(BP), BX
|
||||
MOVL $0xcc9e2d51, BP
|
||||
IMULL BP, DX
|
||||
RORL $0x11, DX
|
||||
MOVL $0x1b873593, BP
|
||||
IMULL BP, DX
|
||||
XORL DX, BX
|
||||
RORL $0x13, BX
|
||||
LEAL (BX)(BX*4), DX
|
||||
LEAL 3864292196(DX), BX
|
||||
MOVL BX, DX
|
||||
SHRL $0x10, DX
|
||||
XORL DX, BX
|
||||
MOVL $0x85ebca6b, DX
|
||||
IMULL DX, BX
|
||||
MOVL BX, DX
|
||||
SHRL $0x0d, DX
|
||||
XORL DX, BX
|
||||
MOVL $0xc2b2ae35, DX
|
||||
IMULL DX, BX
|
||||
MOVL BX, DX
|
||||
SHRL $0x10, DX
|
||||
XORL DX, BX
|
||||
MOVL BX, ret+24(FP)
|
||||
RET
|
||||
|
||||
hash_5_12:
|
||||
MOVL CX, DX
|
||||
MOVL DX, BX
|
||||
SHLL $0x02, BX
|
||||
ADDL DX, BX
|
||||
MOVL $0x00000009, BP
|
||||
MOVL BX, SI
|
||||
ADDL (AX), DX
|
||||
MOVQ CX, DI
|
||||
SUBQ $0x04, DI
|
||||
ADDQ AX, DI
|
||||
ADDL (DI), BX
|
||||
MOVQ CX, DI
|
||||
SHRQ $0x01, DI
|
||||
ANDQ $0x04, DI
|
||||
ADDQ AX, DI
|
||||
ADDL (DI), BP
|
||||
MOVL $0xcc9e2d51, DI
|
||||
IMULL DI, DX
|
||||
RORL $0x11, DX
|
||||
MOVL $0x1b873593, DI
|
||||
IMULL DI, DX
|
||||
XORL DX, SI
|
||||
RORL $0x13, SI
|
||||
LEAL (SI)(SI*4), DX
|
||||
LEAL 3864292196(DX), SI
|
||||
MOVL $0xcc9e2d51, DX
|
||||
IMULL DX, BX
|
||||
RORL $0x11, BX
|
||||
MOVL $0x1b873593, DX
|
||||
IMULL DX, BX
|
||||
XORL BX, SI
|
||||
RORL $0x13, SI
|
||||
LEAL (SI)(SI*4), BX
|
||||
LEAL 3864292196(BX), SI
|
||||
MOVL $0xcc9e2d51, DX
|
||||
IMULL DX, BP
|
||||
RORL $0x11, BP
|
||||
MOVL $0x1b873593, DX
|
||||
IMULL DX, BP
|
||||
XORL BP, SI
|
||||
RORL $0x13, SI
|
||||
LEAL (SI)(SI*4), BP
|
||||
LEAL 3864292196(BP), SI
|
||||
MOVL SI, DX
|
||||
SHRL $0x10, DX
|
||||
XORL DX, SI
|
||||
MOVL $0x85ebca6b, DX
|
||||
IMULL DX, SI
|
||||
MOVL SI, DX
|
||||
SHRL $0x0d, DX
|
||||
XORL DX, SI
|
||||
MOVL $0xc2b2ae35, DX
|
||||
IMULL DX, SI
|
||||
MOVL SI, DX
|
||||
SHRL $0x10, DX
|
||||
XORL DX, SI
|
||||
MOVL SI, ret+24(FP)
|
||||
RET
|
||||
|
||||
hash_13_24:
|
||||
MOVQ CX, DX
|
||||
SHRQ $0x01, DX
|
||||
ADDQ AX, DX
|
||||
MOVL -4(DX), BX
|
||||
MOVL 4(AX), BP
|
||||
MOVQ CX, SI
|
||||
ADDQ AX, SI
|
||||
MOVL -8(SI), DI
|
||||
MOVL (DX), DX
|
||||
MOVL (AX), R8
|
||||
MOVL -4(SI), SI
|
||||
MOVL $0xcc9e2d51, R9
|
||||
IMULL DX, R9
|
||||
ADDL CX, R9
|
||||
RORL $0x0c, BX
|
||||
ADDL SI, BX
|
||||
MOVL DI, R10
|
||||
MOVL $0xcc9e2d51, R11
|
||||
IMULL R11, R10
|
||||
RORL $0x11, R10
|
||||
MOVL $0x1b873593, R11
|
||||
IMULL R11, R10
|
||||
XORL R10, R9
|
||||
RORL $0x13, R9
|
||||
LEAL (R9)(R9*4), R10
|
||||
LEAL 3864292196(R10), R9
|
||||
ADDL BX, R9
|
||||
RORL $0x03, BX
|
||||
ADDL DI, BX
|
||||
MOVL $0xcc9e2d51, DI
|
||||
IMULL DI, R8
|
||||
RORL $0x11, R8
|
||||
MOVL $0x1b873593, DI
|
||||
IMULL DI, R8
|
||||
XORL R8, R9
|
||||
RORL $0x13, R9
|
||||
LEAL (R9)(R9*4), R8
|
||||
LEAL 3864292196(R8), R9
|
||||
ADDL BX, R9
|
||||
ADDL SI, BX
|
||||
RORL $0x0c, BX
|
||||
ADDL DX, BX
|
||||
MOVL $0xcc9e2d51, DX
|
||||
IMULL DX, BP
|
||||
RORL $0x11, BP
|
||||
MOVL $0x1b873593, DX
|
||||
IMULL DX, BP
|
||||
XORL BP, R9
|
||||
RORL $0x13, R9
|
||||
LEAL (R9)(R9*4), BP
|
||||
LEAL 3864292196(BP), R9
|
||||
ADDL BX, R9
|
||||
MOVL R9, DX
|
||||
SHRL $0x10, DX
|
||||
XORL DX, R9
|
||||
MOVL $0x85ebca6b, DX
|
||||
IMULL DX, R9
|
||||
MOVL R9, DX
|
||||
SHRL $0x0d, DX
|
||||
XORL DX, R9
|
||||
MOVL $0xc2b2ae35, DX
|
||||
IMULL DX, R9
|
||||
MOVL R9, DX
|
||||
SHRL $0x10, DX
|
||||
XORL DX, R9
|
||||
MOVL R9, ret+24(FP)
|
||||
RET
|
||||
|
||||
long:
|
||||
MOVL CX, DX
|
||||
MOVL $0xcc9e2d51, BX
|
||||
IMULL DX, BX
|
||||
MOVL BX, BP
|
||||
MOVQ CX, SI
|
||||
ADDQ AX, SI
|
||||
MOVL $0xcc9e2d51, DI
|
||||
MOVL $0x1b873593, R8
|
||||
MOVL -4(SI), R9
|
||||
IMULL DI, R9
|
||||
RORL $0x11, R9
|
||||
IMULL R8, R9
|
||||
XORL R9, DX
|
||||
RORL $0x13, DX
|
||||
MOVL DX, R9
|
||||
SHLL $0x02, R9
|
||||
ADDL R9, DX
|
||||
ADDL $0xe6546b64, DX
|
||||
MOVL -8(SI), R9
|
||||
IMULL DI, R9
|
||||
RORL $0x11, R9
|
||||
IMULL R8, R9
|
||||
XORL R9, BX
|
||||
RORL $0x13, BX
|
||||
MOVL BX, R9
|
||||
SHLL $0x02, R9
|
||||
ADDL R9, BX
|
||||
ADDL $0xe6546b64, BX
|
||||
MOVL -16(SI), R9
|
||||
IMULL DI, R9
|
||||
RORL $0x11, R9
|
||||
IMULL R8, R9
|
||||
XORL R9, DX
|
||||
RORL $0x13, DX
|
||||
MOVL DX, R9
|
||||
SHLL $0x02, R9
|
||||
ADDL R9, DX
|
||||
ADDL $0xe6546b64, DX
|
||||
MOVL -12(SI), R9
|
||||
IMULL DI, R9
|
||||
RORL $0x11, R9
|
||||
IMULL R8, R9
|
||||
XORL R9, BX
|
||||
RORL $0x13, BX
|
||||
MOVL BX, R9
|
||||
SHLL $0x02, R9
|
||||
ADDL R9, BX
|
||||
ADDL $0xe6546b64, BX
|
||||
PREFETCHT0 (AX)
|
||||
MOVL -20(SI), SI
|
||||
IMULL DI, SI
|
||||
RORL $0x11, SI
|
||||
IMULL R8, SI
|
||||
ADDL SI, BP
|
||||
RORL $0x13, BP
|
||||
ADDL $0x71, BP
|
||||
|
||||
loop80:
|
||||
CMPQ CX, $0x64
|
||||
JL loop20
|
||||
PREFETCHT0 20(AX)
|
||||
MOVL (AX), SI
|
||||
ADDL SI, DX
|
||||
MOVL 4(AX), DI
|
||||
ADDL DI, BX
|
||||
MOVL 8(AX), R8
|
||||
ADDL R8, BP
|
||||
MOVL 12(AX), R9
|
||||
MOVL R9, R11
|
||||
MOVL $0xcc9e2d51, R10
|
||||
IMULL R10, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R10
|
||||
IMULL R10, R11
|
||||
XORL R11, DX
|
||||
RORL $0x13, DX
|
||||
LEAL (DX)(DX*4), R11
|
||||
LEAL 3864292196(R11), DX
|
||||
MOVL 16(AX), R10
|
||||
ADDL R10, DX
|
||||
MOVL R8, R11
|
||||
MOVL $0xcc9e2d51, R8
|
||||
IMULL R8, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R8
|
||||
IMULL R8, R11
|
||||
XORL R11, BX
|
||||
RORL $0x13, BX
|
||||
LEAL (BX)(BX*4), R11
|
||||
LEAL 3864292196(R11), BX
|
||||
ADDL SI, BX
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R10
|
||||
MOVL R10, R11
|
||||
ADDL DI, R11
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, SI
|
||||
IMULL SI, R11
|
||||
XORL R11, BP
|
||||
RORL $0x13, BP
|
||||
LEAL (BP)(BP*4), R11
|
||||
LEAL 3864292196(R11), BP
|
||||
ADDL R9, BP
|
||||
ADDL BX, BP
|
||||
ADDL BP, BX
|
||||
PREFETCHT0 40(AX)
|
||||
MOVL 20(AX), SI
|
||||
ADDL SI, DX
|
||||
MOVL 24(AX), DI
|
||||
ADDL DI, BX
|
||||
MOVL 28(AX), R8
|
||||
ADDL R8, BP
|
||||
MOVL 32(AX), R9
|
||||
MOVL R9, R11
|
||||
MOVL $0xcc9e2d51, R10
|
||||
IMULL R10, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R10
|
||||
IMULL R10, R11
|
||||
XORL R11, DX
|
||||
RORL $0x13, DX
|
||||
LEAL (DX)(DX*4), R11
|
||||
LEAL 3864292196(R11), DX
|
||||
MOVL 36(AX), R10
|
||||
ADDL R10, DX
|
||||
MOVL R8, R11
|
||||
MOVL $0xcc9e2d51, R8
|
||||
IMULL R8, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R8
|
||||
IMULL R8, R11
|
||||
XORL R11, BX
|
||||
RORL $0x13, BX
|
||||
LEAL (BX)(BX*4), R11
|
||||
LEAL 3864292196(R11), BX
|
||||
ADDL SI, BX
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R10
|
||||
MOVL R10, R11
|
||||
ADDL DI, R11
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, SI
|
||||
IMULL SI, R11
|
||||
XORL R11, BP
|
||||
RORL $0x13, BP
|
||||
LEAL (BP)(BP*4), R11
|
||||
LEAL 3864292196(R11), BP
|
||||
ADDL R9, BP
|
||||
ADDL BX, BP
|
||||
ADDL BP, BX
|
||||
PREFETCHT0 60(AX)
|
||||
MOVL 40(AX), SI
|
||||
ADDL SI, DX
|
||||
MOVL 44(AX), DI
|
||||
ADDL DI, BX
|
||||
MOVL 48(AX), R8
|
||||
ADDL R8, BP
|
||||
MOVL 52(AX), R9
|
||||
MOVL R9, R11
|
||||
MOVL $0xcc9e2d51, R10
|
||||
IMULL R10, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R10
|
||||
IMULL R10, R11
|
||||
XORL R11, DX
|
||||
RORL $0x13, DX
|
||||
LEAL (DX)(DX*4), R11
|
||||
LEAL 3864292196(R11), DX
|
||||
MOVL 56(AX), R10
|
||||
ADDL R10, DX
|
||||
MOVL R8, R11
|
||||
MOVL $0xcc9e2d51, R8
|
||||
IMULL R8, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R8
|
||||
IMULL R8, R11
|
||||
XORL R11, BX
|
||||
RORL $0x13, BX
|
||||
LEAL (BX)(BX*4), R11
|
||||
LEAL 3864292196(R11), BX
|
||||
ADDL SI, BX
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R10
|
||||
MOVL R10, R11
|
||||
ADDL DI, R11
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, SI
|
||||
IMULL SI, R11
|
||||
XORL R11, BP
|
||||
RORL $0x13, BP
|
||||
LEAL (BP)(BP*4), R11
|
||||
LEAL 3864292196(R11), BP
|
||||
ADDL R9, BP
|
||||
ADDL BX, BP
|
||||
ADDL BP, BX
|
||||
PREFETCHT0 80(AX)
|
||||
MOVL 60(AX), SI
|
||||
ADDL SI, DX
|
||||
MOVL 64(AX), DI
|
||||
ADDL DI, BX
|
||||
MOVL 68(AX), R8
|
||||
ADDL R8, BP
|
||||
MOVL 72(AX), R9
|
||||
MOVL R9, R11
|
||||
MOVL $0xcc9e2d51, R10
|
||||
IMULL R10, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R10
|
||||
IMULL R10, R11
|
||||
XORL R11, DX
|
||||
RORL $0x13, DX
|
||||
LEAL (DX)(DX*4), R11
|
||||
LEAL 3864292196(R11), DX
|
||||
MOVL 76(AX), R10
|
||||
ADDL R10, DX
|
||||
MOVL R8, R11
|
||||
MOVL $0xcc9e2d51, R8
|
||||
IMULL R8, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R8
|
||||
IMULL R8, R11
|
||||
XORL R11, BX
|
||||
RORL $0x13, BX
|
||||
LEAL (BX)(BX*4), R11
|
||||
LEAL 3864292196(R11), BX
|
||||
ADDL SI, BX
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R10
|
||||
MOVL R10, R11
|
||||
ADDL DI, R11
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, SI
|
||||
IMULL SI, R11
|
||||
XORL R11, BP
|
||||
RORL $0x13, BP
|
||||
LEAL (BP)(BP*4), R11
|
||||
LEAL 3864292196(R11), BP
|
||||
ADDL R9, BP
|
||||
ADDL BX, BP
|
||||
ADDL BP, BX
|
||||
ADDQ $0x50, AX
|
||||
SUBQ $0x50, CX
|
||||
JMP loop80
|
||||
|
||||
loop20:
|
||||
CMPQ CX, $0x14
|
||||
JLE after
|
||||
MOVL (AX), SI
|
||||
ADDL SI, DX
|
||||
MOVL 4(AX), DI
|
||||
ADDL DI, BX
|
||||
MOVL 8(AX), R8
|
||||
ADDL R8, BP
|
||||
MOVL 12(AX), R9
|
||||
MOVL R9, R11
|
||||
MOVL $0xcc9e2d51, R10
|
||||
IMULL R10, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R10
|
||||
IMULL R10, R11
|
||||
XORL R11, DX
|
||||
RORL $0x13, DX
|
||||
LEAL (DX)(DX*4), R11
|
||||
LEAL 3864292196(R11), DX
|
||||
MOVL 16(AX), R10
|
||||
ADDL R10, DX
|
||||
MOVL R8, R11
|
||||
MOVL $0xcc9e2d51, R8
|
||||
IMULL R8, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, R8
|
||||
IMULL R8, R11
|
||||
XORL R11, BX
|
||||
RORL $0x13, BX
|
||||
LEAL (BX)(BX*4), R11
|
||||
LEAL 3864292196(R11), BX
|
||||
ADDL SI, BX
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R10
|
||||
MOVL R10, R11
|
||||
ADDL DI, R11
|
||||
MOVL $0xcc9e2d51, SI
|
||||
IMULL SI, R11
|
||||
RORL $0x11, R11
|
||||
MOVL $0x1b873593, SI
|
||||
IMULL SI, R11
|
||||
XORL R11, BP
|
||||
RORL $0x13, BP
|
||||
LEAL (BP)(BP*4), R11
|
||||
LEAL 3864292196(R11), BP
|
||||
ADDL R9, BP
|
||||
ADDL BX, BP
|
||||
ADDL BP, BX
|
||||
ADDQ $0x14, AX
|
||||
SUBQ $0x14, CX
|
||||
JMP loop20
|
||||
|
||||
after:
|
||||
MOVL $0xcc9e2d51, AX
|
||||
RORL $0x0b, BX
|
||||
IMULL AX, BX
|
||||
RORL $0x11, BX
|
||||
IMULL AX, BX
|
||||
RORL $0x0b, BP
|
||||
IMULL AX, BP
|
||||
RORL $0x11, BP
|
||||
IMULL AX, BP
|
||||
ADDL BX, DX
|
||||
RORL $0x13, DX
|
||||
MOVL DX, CX
|
||||
SHLL $0x02, CX
|
||||
ADDL CX, DX
|
||||
ADDL $0xe6546b64, DX
|
||||
RORL $0x11, DX
|
||||
IMULL AX, DX
|
||||
ADDL BP, DX
|
||||
RORL $0x13, DX
|
||||
MOVL DX, CX
|
||||
SHLL $0x02, CX
|
||||
ADDL CX, DX
|
||||
ADDL $0xe6546b64, DX
|
||||
RORL $0x11, DX
|
||||
IMULL AX, DX
|
||||
MOVL DX, ret+24(FP)
|
||||
RET
|
||||
13
vendor/github.com/dgryski/go-farm/fp_generic.go
generated
vendored
Normal file
13
vendor/github.com/dgryski/go-farm/fp_generic.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// +build !amd64 purego
|
||||
|
||||
package farm
|
||||
|
||||
// Fingerprint64 is a 64-bit fingerprint function for byte-slices
|
||||
func Fingerprint64(s []byte) uint64 {
|
||||
return naHash64(s)
|
||||
}
|
||||
|
||||
// Fingerprint32 is a 32-bit fingerprint function for byte-slices
|
||||
func Fingerprint32(s []byte) uint32 {
|
||||
return Hash32(s)
|
||||
}
|
||||
9
vendor/github.com/dgryski/go-farm/fp_stub.go
generated
vendored
Normal file
9
vendor/github.com/dgryski/go-farm/fp_stub.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// Code generated by command: go run asm.go -out=fp_amd64.s -stubs=fp_stub.go. DO NOT EDIT.
|
||||
|
||||
// +build amd64,!purego
|
||||
|
||||
package farm
|
||||
|
||||
func Fingerprint64(s []byte) uint64
|
||||
|
||||
func Fingerprint32(s []byte) uint32
|
||||
Reference in New Issue
Block a user