예제 #1
0
파일: test.go 프로젝트: twmb/murmur3
func SeedSum128(seed uint32, data []byte) (h1, h2 uint64) {
	header := *(*reflect.SliceHeader)(unsafe.Pointer(&data))
	var out struct {
		h1 uint64
		h2 uint64
	}
	C.MurmurHash3_x64_128(unsafe.Pointer(header.Data), C.int(len(data)), C.uint32_t(seed), unsafe.Pointer(&out))
	return out.h1, out.h2
}
예제 #2
0
파일: murmur.go 프로젝트: ckolbeck/god
// Extrude will fill the provided slice with the hash for all consumed data.
// Extrude is slightly less allocating than Get, if that kind of thing is of interest.
func (self *Hash) Extrude(result *[]byte) {
	buf := (*bytes.Buffer)(self).Bytes()
	C.MurmurHash3_x64_128(
		*(*unsafe.Pointer)(unsafe.Pointer(&buf)),
		C.int(len(buf)),
		C.uint32_t(seed),
		*(*unsafe.Pointer)(unsafe.Pointer(result)))
	self.Reset()
}
예제 #3
0
파일: murmur.go 프로젝트: baeeq/god
func hash64(key unsafe.Pointer, length C.int, seed C.uint32_t, out unsafe.Pointer) {
	C.MurmurHash3_x64_128(key, length, seed, out)
}