crc32_amd64.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //+build !noasm
  2. //+build !appengine
  3. //+build !gccgo
  4. // Copyright 2015, Klaus Post, see LICENSE for details.
  5. package flate
  6. import (
  7. "github.com/klauspost/cpuid"
  8. )
  9. // crc32sse returns a hash for the first 4 bytes of the slice
  10. // len(a) must be >= 4.
  11. //go:noescape
  12. func crc32sse(a []byte) uint32
  13. // crc32sseAll calculates hashes for each 4-byte set in a.
  14. // dst must be east len(a) - 4 in size.
  15. // The size is not checked by the assembly.
  16. //go:noescape
  17. func crc32sseAll(a []byte, dst []uint32)
  18. // matchLenSSE4 returns the number of matching bytes in a and b
  19. // up to length 'max'. Both slices must be at least 'max'
  20. // bytes in size.
  21. //
  22. // TODO: drop the "SSE4" name, since it doesn't use any SSE instructions.
  23. //
  24. //go:noescape
  25. func matchLenSSE4(a, b []byte, max int) int
  26. // histogram accumulates a histogram of b in h.
  27. // h must be at least 256 entries in length,
  28. // and must be cleared before calling this function.
  29. //go:noescape
  30. func histogram(b []byte, h []int32)
  31. // Detect SSE 4.2 feature.
  32. func init() {
  33. useSSE42 = cpuid.CPU.SSE42()
  34. }