func New(seed uint32) hash.Hash64 {
	d := new(Digest)
	d.seed = seed
	d.Reset()
	return d
}
New returns a new hash.Hash64 interface that computes the a 32 bit murmur3 hash.
package jenkins3
import (
	"fmt"
	"hash"
	"unsafe"
)
type Digest struct {
	hash uint64
	seed uint32
	pc   uint32
	pb   uint32
	clen int
	tail []byte
}
const Size = 4
var (
	_ hash.Hash64 = new(Digest)
)
func HashWords64(k []uint64, length int, seed uint64) uint64 {
	var a, b, c uint64
	if length > len(k) {
		fmt.Printf("length=%d, len(k)=%d\n", length, len(k))
		panic("HashWords")
	}
	ul := uint64(len(k))
	a = 0x9e3779b97f4a7c13 + ul<<2 + seed
	b, c = a, a
	cnt := 0
	for i := 0; i < length; i++ {
		switch cnt {
		case 0:
			a = k[i]
		case 1:
			b = k[i]
		case 2:
			c = k[i]
			cnt = 0
		}
		a = a - b
		a = a - c
		a = a ^ (c >> 43)
		b = b - c
		b = b - a
		b = b ^ (a << 9)
		c = c - a
		c = c - b
		c = c ^ (b >> 8)
		a = a - b
		a = a - c
		a = a ^ (c >> 38)
		b = b - c
		b = b - a
		b = b ^ (a << 23)
		c = c - a
		c = c - b
		c = c ^ (b >> 5)
		a = a - b
		a = a - c
		a = a ^ (c >> 35)
		b = b - c
		b = b - a
		b = b ^ (a << 49)
		c = c - a
		c = c - b
		c = c ^ (b >> 11)
		a = a - b
		a = a - c
		a = a ^ (c >> 12)
		b = b - c
		b = b - a
		b = b ^ (a << 18)
		c = c - a
		c = c - b
		c = c ^ (b >> 22)
	}
	return c
}
func rot(x, k uint32) uint32 {
	return x<<k | x>>(32-k)
}
func mix1(a, b, c uint32) (uint32, uint32, uint32) {
	a -= c
	a ^= rot(c, 4)
	c += b
	b -= a
	b ^= rot(a, 6)
	a += c
	c -= b
	c ^= rot(b, 8)
	b += a
	return a, b, c
}
func mix2(a, b, c uint32) (uint32, uint32, uint32) {
	a -= c
	a ^= rot(c, 16)
	c += b
	b -= a
	b ^= rot(a, 19)
	a += c
	c -= b
	c ^= rot(b, 4)
	b += a
	return a, b, c
}
func final1(a, b, c uint32) (uint32, uint32, uint32) {
	c ^= b
	c -= rot(b, 14)
	a ^= c
	a -= rot(c, 11)
	b ^= a
	b -= rot(a, 25)
	c ^= b
	c -= rot(b, 16)
	return a, b, c
}
func final2(a, b, c uint32) (uint32, uint32, uint32) {
	a ^= c
	a -= rot(c, 4)
	b ^= a
	b -= rot(a, 14)
	c ^= b
	c -= rot(b, 24)
	return a, b, c
}
func HashWords32(k []uint32, seed uint32) uint32 {
	var a, b, c uint32
	length := uint32(len(k))
	a = 0xdeadbeef + length<<2 + seed
	b, c = a, a
	i := 0
	for ; length > 3; length -= 3 {
		a += k[i+0]
		b += k[i+1]
		c += k[i+2]
		a, b, c = mix1(a, b, c)
		a, b, c = mix2(a, b, c)
		i += 3
	}
	switch length {
	case 3:
		c += k[i+2]
		fallthrough
	case 2:
		b += k[i+1]
		fallthrough
	case 1:
		a += k[i+0]
		a, b, c = final1(a, b, c)
		a, b, c = final2(a, b, c)
	case 0:
		break
	}
	return c
}
func HashWordsLen(k []uint32, length int, seed uint32) uint32 {
	var a, b, c uint32
	if length > len(k) {
		fmt.Printf("length=%d, len(k)=%d\n", length, len(k))
		panic("HashWords")
	}
	ul := uint32(len(k))
	a = 0xdeadbeef + ul<<2 + seed
	b, c = a, a
	i := 0
	for ; length > 3; length -= 3 {
		a += k[i+0]
		b += k[i+1]
		c += k[i+2]
		a, b, c = mix1(a, b, c)
		a, b, c = mix2(a, b, c)
		i += 3
	}
	switch length {
	case 3:
		c += k[i+2]
		fallthrough
	case 2:
		b += k[i+1]
		fallthrough
	case 1:
		a += k[i+0]
		a, b, c = final1(a, b, c)
		a, b, c = final2(a, b, c)
	case 0:
		break
	}
	return c
}
func XHashWords(k []uint32, length int, seed uint32) uint32 {
	var a, b, c uint32
	var rot = func(x, k uint32) uint32 {
		return x<<k | x>>(32-k)
	}
	var mix = func() {
		a -= c
		a ^= rot(c, 4)
		c += b
		b -= a
		b ^= rot(a, 6)
		a += c
		c -= b
		c ^= rot(b, 8)
		b += a
		a -= c
		a ^= rot(c, 16)
		c += b
		b -= a
		b ^= rot(a, 19)
		a += c
		c -= b
		c ^= rot(b, 4)
		b += a
	}
	var final = func() {
		c ^= b
		c -= rot(b, 14)
		a ^= c
		a -= rot(c, 11)
		b ^= a
		b -= rot(a, 25)
		c ^= b
		c -= rot(b, 16)
		a ^= c
		a -= rot(c, 4)
		b ^= a
		b -= rot(a, 14)
		c ^= b
		c -= rot(b, 24)
	}
	ul := uint32(len(k))
	a = 0xdeadbeef + ul<<2 + seed
	b, c = a, a
	i := 0
	for length = len(k); length > 3; length -= 3 {
		a += k[i+0]
		b += k[i+1]
		c += k[i+2]
		mix()
		i += 3
	}
	switch length {
	case 3:
		c += k[i+2]
		fallthrough
	case 2:
		b += k[i+1]
		fallthrough
	case 1:
		a += k[i+0]
		final()
	case 0:
		break
	}
	return c
}
func Jenkins364(k []byte, length int, pc, pb uint32) (rpc, rpb uint32) {
	var a, b, c uint32
	ul := uint32(len(k))
	a = 0xdeadbeef + ul + pc
	b, c = a, a
	c += pb
	for ; length > 12; length -= 12 {
		a += *(*uint32)(unsafe.Pointer(&k[0]))
		b += *(*uint32)(unsafe.Pointer(&k[4]))
		c += *(*uint32)(unsafe.Pointer(&k[8]))
		a, b, c = mix1(a, b, c)
		a, b, c = mix2(a, b, c)
		k = k[12:]
	}
	switch length {
	case 12:
		a += *(*uint32)(unsafe.Pointer(&k[0]))
		b += *(*uint32)(unsafe.Pointer(&k[4]))
		c += *(*uint32)(unsafe.Pointer(&k[8]))
	case 11:
		c += uint32(k[10]) << 16
		fallthrough
	case 10:
		c += uint32(k[9]) << 8
		fallthrough
	case 9:
		c += uint32(k[8])
		fallthrough
	case 8:
		a += *(*uint32)(unsafe.Pointer(&k[0]))
		b += *(*uint32)(unsafe.Pointer(&k[4]))
		break
	case 7:
		b += uint32(k[6]) << 16
		fallthrough
	case 6:
		b += uint32(k[5]) << 8
		fallthrough
	case 5:
		b += uint32(k[4])
		fallthrough
	case 4:
		a += *(*uint32)(unsafe.Pointer(&k[0]))
		break
	case 3:
		a += uint32(k[2]) << 16
		fallthrough
	case 2:
		a += uint32(k[1]) << 8
		fallthrough
	case 1:
		a += uint32(k[0])
		break
	case 0:
		return c, b  
	}
	a, b, c = final1(a, b, c)
	a, b, c = final2(a, b, c)
	return c, b
}
func HashString(s string, pc, pb uint32) (rpc, rpb uint32) {
	k := ([]byte)(s)
	rpc, rpb = Jenkins364(k, len(k), pc, pb)
	return
}
func HashBytesLength(k []byte, length int, seed uint32) uint32 {
	if length > len(k) {
		fmt.Printf("len(k)=%d, length=%d\n", len(k), length)
		panic("HashBytesLength")
	}
	ret, _ := Jenkins364(k, length, seed, seed)
	return ret
}
func Sum32(data []byte, seed uint32) uint32 {
	rpc, _ := Jenkins364(data, len(data), seed, seed)
	return rpc
}
func Sum64(data []byte, seed uint32) uint64 {
	rpc, rpb := Jenkins364(data, len(data), seed, seed)
	return uint64(rpc)<<32 | uint64(rpb)
}
func HashBytes(data []byte, seed uint64) uint64 {
	rpc, rpb := Jenkins364(data, len(data), uint32(seed>>32), uint32(seed&0xFFFFFFFF))
	return uint64(rpc)<<32 | uint64(rpb)
}