Example #1
0
func (xx *xxHash32) Write(p []byte) (n int, err error) {
	switch {
	case xx.state == nil:
		return 0, ErrAlreadyComputed
	case len(p) > oneGb:
		return 0, ErrMemoryLimit
	}
	C.XXH32_update(xx.state, unsafe.Pointer(&p[0]), C.uint(len(p)))
	return len(p), nil
}
Example #2
0
func (xx *XXHash32) Write(p []byte) (n int, err error) {
	C.XXH32_update(&xx.state, unsafe.Pointer(&p[0]), C.size_t(len(p)))
	return len(p), nil
}