Files
hk4e-go/gate/kcp/byte_check_cgo.go
T
2024-09-23 18:31:42 +08:00

24 lines
330 B
Go

//go:build xxhash
// +build xxhash
package kcp
// #include "./cgo/xxhash.c"
import "C"
func byte_check_hash(data []byte) uint32 {
switch byteCheckMode {
case 0:
return 0
case 1:
return 0
case 2:
d := C.CBytes(data)
h := C.XXH3_64bits(d, C.size_t(len(data)))
C.free(d)
return uint32(h)
default:
return 0
}
}