示例#1
0
文件: hll.go 项目: sgichohi/go-stream
func (hll *Hll) AddInt64(value int64) {
	cValue := C.int64_t(value)
	cSeed := C.int32_t(0)

	cHashKey := C.hll_hash_int64(cValue, cSeed)

	C.multiset_add(hll.ms, cHashKey)
}
示例#2
0
文件: hll.go 项目: sgichohi/go-stream
func (hll *Hll) Add(value string) {
	cValue := C.CString(value)
	defer C.free(unsafe.Pointer(cValue))

	cSeed := C.int(0)
	lVal := C.int(len(value))
	cHashKey := C.hll_hash_varlena(cValue, lVal, cSeed)

	C.multiset_add(hll.ms, cHashKey)
}
示例#3
0
文件: hll.go 项目: sgichohi/go-stream
func (hll *Hll) Add8Bytes(value []byte) error {
	if len(value) != 8 {
		return HllError(fmt.Sprintf("Length on input is not 8 -- %d", len(value)))
	}

	cValue := (*C.char)(unsafe.Pointer(&value[0]))
	cSeed := C.int32_t(0)

	cHashKey := C.hll_hash_8bytes(cValue, cSeed)
	C.multiset_add(hll.ms, cHashKey)

	return nil
}