crc32_amd64.go 1.0 KB

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