mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-02 19:37:40 +03:00
24 lines
353 B
Go
24 lines
353 B
Go
package clashtcpip
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"golang.org/x/sys/cpu"
|
|
)
|
|
|
|
//go:noescape
|
|
func sumAsmNeon(data unsafe.Pointer, length uintptr) uintptr
|
|
|
|
func SumNeon(data []byte) uint32 {
|
|
if len(data) == 0 {
|
|
return 0
|
|
}
|
|
|
|
return uint32(sumAsmNeon(unsafe.Pointer(&data[0]), uintptr(len(data))))
|
|
}
|
|
|
|
func init() {
|
|
if cpu.ARM64.HasASIMD {
|
|
SumFnc = SumNeon
|
|
}
|
|
}
|