Documentation ¶
Overview ¶
Package hamming distance calculations in Go
https://github.com/steakknife/hamming
Copyright © 2014, 2015, 2016, 2018 Barry Allard ¶
MIT license ¶
Usage ¶
For functions named CountBits.+s?. The plural forms are for slices. The CountBits.+ forms are Population Count only, where the bare-type forms are Hamming distance (number of bits different) between two values.
Optimized assembly .+PopCnt forms are available on amd64, and operate just like the regular forms (Must check and guard on HasPopCnt() first before trying to call .+PopCnt functions).
import 'github.com/steakknife/hamming' // ... // hamming distance between values hamming.Byte(0xFF, 0x00) // 8 hamming.Byte(0x00, 0x00) // 0 // just count bits in a byte hamming.CountBitsByte(0xA5), // 4
Got rune? use int32 Got uint8? use byte
Package hamming distance calculations in Go ¶
https://github.com/steakknife/hamming
Copyright © 2014, 2015, 2016, 2018 Barry Allard ¶
MIT license ¶
Package hamming distance calculations in Go ¶
https://github.com/steakknife/hamming
Copyright © 2014, 2015, 2016, 2018 Barry Allard ¶
MIT license ¶
Package hamming distance calculations in Go ¶
https://github.com/steakknife/hamming
Copyright © 2014, 2015, 2016, 2018 Barry Allard ¶
MIT license ¶
Package hamming distance calculations in Go ¶
https://github.com/steakknife/hamming
Copyright © 2014, 2015, 2016, 2018 Barry Allard ¶
MIT license ¶
Package hamming distance calculations in Go ¶
https://github.com/steakknife/hamming
Copyright © 2014, 2015, 2016, 2018 Barry Allard ¶
MIT license ¶
Package hamming distance calculations in Go ¶
https://github.com/steakknife/hamming
Copyright © 2014, 2015, 2016, 2018 Barry Allard ¶
MIT license
Index ¶
- func Byte(x, y byte) int
- func Bytes(b0, b1 []byte) int
- func CountBitsByte(x byte) int
- func CountBitsByteAlt(x byte) int
- func CountBitsBytePopCnt(x byte) (ret int)
- func CountBitsBytes(b []byte) int
- func CountBitsBytesPopCnt(x []byte) (ret int)
- func CountBitsInt(x int) int
- func CountBitsInt16(x int16) int
- func CountBitsInt16PopCnt(x int16) (ret int)
- func CountBitsInt16s(b []int16) int
- func CountBitsInt16sPopCnt(x []int16) (ret int)
- func CountBitsInt32(x int32) int
- func CountBitsInt32PopCnt(x int32) (ret int)
- func CountBitsInt32s(b []int32) int
- func CountBitsInt32sPopCnt(x []int32) (ret int)
- func CountBitsInt64(x int64) int
- func CountBitsInt64PopCnt(x int64) (ret int)
- func CountBitsInt64s(b []int64) int
- func CountBitsInt64sPopCnt(x []int64) (ret int)
- func CountBitsInt8(x int8) int
- func CountBitsInt8PopCnt(x int8) (ret int)
- func CountBitsInt8s(b []int8) int
- func CountBitsInt8sPopCnt(x []int8) (ret int)
- func CountBitsIntPopCnt(x int) int
- func CountBitsInts(b []int) int
- func CountBitsIntsPopCnt(x []int) int
- func CountBitsRune(x rune) int
- func CountBitsRunePopCnt(x rune) (ret int)
- func CountBitsRunes(b []rune) int
- func CountBitsRunesPopCnt(x []rune) (ret int)
- func CountBitsString(s string) int
- func CountBitsStringPopCnt(s string) (ret int)
- func CountBitsUint(x uint) int
- func CountBitsUint16(x uint16) int
- func CountBitsUint16PopCnt(x uint16) (ret int)
- func CountBitsUint16s(b []uint16) int
- func CountBitsUint16sPopCnt(x []uint16) (ret int)
- func CountBitsUint32(x uint32) int
- func CountBitsUint32PopCnt(x uint32) (ret int)
- func CountBitsUint32s(b []uint32) int
- func CountBitsUint32sPopCnt(x []uint32) (ret int)
- func CountBitsUint64(x uint64) int
- func CountBitsUint64Alt(x uint64) int
- func CountBitsUint64PopCnt(x uint64) (ret int)
- func CountBitsUint64s(b []uint64) int
- func CountBitsUint64sPopCnt(x []uint64) (ret int)
- func CountBitsUint8(x uint8) int
- func CountBitsUint8PopCnt(x uint8) (ret int)
- func CountBitsUint8s(b []uint8) int
- func CountBitsUint8sPopCnt(x []uint8) (ret int)
- func CountBitsUintPopCnt(x uint) int
- func CountBitsUintReference(x uint) int
- func CountBitsUints(b []uint) int
- func CountBitsUintsPopCnt(x []uint) int
- func HasPopCnt() (ret bool)
- func Int(x, y int) int
- func Int16(x, y int16) int
- func Int16s(b0, b1 []int16) int
- func Int32(x, y int32) int
- func Int32s(b0, b1 []int32) int
- func Int64(x, y int64) int
- func Int64s(b0, b1 []int64) int
- func Int8(x, y int8) int
- func Int8s(b0, b1 []int8) int
- func Ints(b0, b1 []int) int
- func Rune(x, y rune) int
- func Runes(b0, b1 []rune) int
- func Strings(b0, b1 string) int
- func Uint(x, y uint) int
- func Uint16(x, y uint16) int
- func Uint16s(b0, b1 []uint16) int
- func Uint32(x, y uint32) int
- func Uint32s(b0, b1 []uint32) int
- func Uint64(x, y uint64) int
- func Uint64s(b0, b1 []uint64) int
- func Uint8(x, y uint8) int
- func Uint8s(b0, b1 []uint8) int
- func Uints(b0, b1 []uint) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes hamming distance of two byte buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func CountBitsByteAlt ¶
CountBitsByteAlt table-less, branch-free implementation
func CountBitsBytePopCnt ¶
CountBitsBytePopCnt count 1's in x
func CountBitsBytesPopCnt ¶
CountBitsBytesPopCnt count 1's in x
func CountBitsInt16PopCnt ¶
CountBitsInt16PopCnt count 1's in x
func CountBitsInt16sPopCnt ¶
CountBitsInt16sPopCnt count 1's in x
func CountBitsInt32PopCnt ¶
CountBitsInt32PopCnt count 1's in x
func CountBitsInt32sPopCnt ¶
CountBitsInt32sPopCnt count 1's in x
func CountBitsInt64PopCnt ¶
CountBitsInt64PopCnt count 1's in x
func CountBitsInt64sPopCnt ¶
CountBitsInt64sPopCnt count 1's in x
func CountBitsInt8PopCnt ¶
CountBitsInt8PopCnt count 1's in x
func CountBitsInt8sPopCnt ¶
CountBitsInt8sPopCnt count 1's in x
func CountBitsRunePopCnt ¶
CountBitsRunePopCnt count 1's in x
func CountBitsRunesPopCnt ¶
CountBitsRunesPopCnt count 1's in x
func CountBitsStringPopCnt ¶
CountBitsStringPopCnt count 1's in s
func CountBitsUint16PopCnt ¶
CountBitsUint16PopCnt count 1's in x
func CountBitsUint16sPopCnt ¶
CountBitsUint16sPopCnt count 1's in x
func CountBitsUint32PopCnt ¶
CountBitsUint32PopCnt count 1's in x
func CountBitsUint32sPopCnt ¶
CountBitsUint32sPopCnt count 1's in x
func CountBitsUint64PopCnt ¶
CountBitsUint64PopCnt count 1's in x
func CountBitsUint64sPopCnt ¶
CountBitsUint64sPopCnt count 1's in x
func CountBitsUint8PopCnt ¶
CountBitsUint8PopCnt count 1's in x
func CountBitsUint8sPopCnt ¶
CountBitsUint8sPopCnt count 1's in x
func CountBitsUintReference ¶
CountBitsUintReference count 1's in x
func CountBitsUintsPopCnt ¶
CountBitsUintsPopCnt count 1's in x
func HasPopCnt ¶
func HasPopCnt() (ret bool)
HasPopCnt returns true if *PopCnt functions are callable
func Int16s ¶
Int16s hamming distance of two int16 buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Int32s ¶
Int32s hamming distance of two int32 buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Int64s ¶
Int64s hamming distance of two int64 buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Int8s ¶
Int8s hamming distance of two int8 buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Ints ¶
Ints hamming distance of two int buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Runes ¶
Runes hamming distance of two rune buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Strings ¶
Strings hamming distance of two strings, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Uint16s ¶
Uint16s hamming distance of two uint16 buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Uint32s ¶
Uint32s hamming distance of two uint32 buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
func Uint64s ¶
Uint64s hamming distance of two uint64 buffers, of which the size of b0 is used for both (panics if b1 < b0, does not compare b1 beyond length of b0)
Types ¶
This section is empty.