checksum_arm64.go 431 B

123456789101112
  1. package checksum
  2. //go:noescape
  3. func checksumNEON(buf []byte, initial uint16) uint16
  4. // Checksum computes the RFC 1071 ones-complement sum of buf, seeded with
  5. // initial. It is a drop-in replacement for gvisor's checksum.Checksum
  6. // that dispatches to a hand-written NEON routine. NEON is mandatory in
  7. // armv8 so no feature check is needed.
  8. func Checksum(buf []byte, initial uint16) uint16 {
  9. return checksumNEON(buf, initial)
  10. }