doc.go 928 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // Package hamming distance calculations in Go
  3. //
  4. // https://github.com/steakknife/hamming
  5. //
  6. // Copyright © 2014, 2015, 2016, 2018 Barry Allard
  7. //
  8. // MIT license
  9. //
  10. //
  11. // Usage
  12. //
  13. // For functions named CountBits.+s?. The plural forms are for slices.
  14. // The CountBits.+ forms are Population Count only, where the bare-type
  15. // forms are Hamming distance (number of bits different) between two values.
  16. //
  17. // Optimized assembly .+PopCnt forms are available on amd64, and operate just
  18. // like the regular forms (Must check and guard on HasPopCnt() first before
  19. // trying to call .+PopCnt functions).
  20. //
  21. // import 'github.com/steakknife/hamming'
  22. //
  23. // // ...
  24. //
  25. // // hamming distance between values
  26. // hamming.Byte(0xFF, 0x00) // 8
  27. // hamming.Byte(0x00, 0x00) // 0
  28. //
  29. // // just count bits in a byte
  30. // hamming.CountBitsByte(0xA5), // 4
  31. //
  32. // Got rune? use int32
  33. // Got uint8? use byte
  34. //
  35. package hamming